I have a question regarding duplicates in Microstrategy.
I have a data set which has all tickets 'Not Closed' along with the 'Work Info Work Log Date' field added. Work Info Work Log Date column shows every timestamp a ticket was updated, which ultimately leads to duplicate rows. What I want to know is if there is a way I can remove duplicates prior to exporting my report. The function I need is similar to this If/then/else statement below. Any help is greatly appreciated. Thank you.
> IF status <> "Assigned" and "Work Info Work Log Date" = ""
> THEN,DEL ROW (what this is doing is obviously checking if a ticket is not in "Assigned" Status, additionally, if the Work Info Work Log
> Date is blank, then delete the entire row).
> ELSE Unfilter ALL, sort "Work Info Work Log Date" from Newest to Oldest, sort Ticket Number from A-Z, then remove All duplicates.
> END
Thank you for the help!
P
else, Sort Work Info Work Log Date Newest to Oldest
Sort Ticket # in Ascending Order
Remove Duplicates
What if you take the max(log date) for each ticket?
Related
In SSRS 2017, I am comparing the values of a certain column in each group so if the record is more than the previous record in that group, then I want another column to say greater, if it's less then say less, etc.... So the last record in each group shouldn't have anything to compare against and should be the default.
Here is what I have that works except for the last row:
=IIF(Fields!margin.Value > Previous(Fields!margin.Value, "GroupByItem"), "greater than",
IIF(Fields!margin.Value < Previous(Fields!margin.Value, "GroupByItem"), "Less", "Equal"))
If I try to use this, I get an error (Overload resolution failed because no accessible 'IIF' accepts this number of arguments):
=IIF((Fields!margin.Value, "GroupByItem") > Previous(Fields!margin.Value, "GroupByItem"), "greater than",
IIF((Fields!margin.Value, "GroupByItem") < Previous(Fields!margin.Value, "GroupByItem"), "Less", "Equal"))
I'm really just looking for a way to say If this is the last record in a group then do this. But the last function seems to only find the last value.
Unfortunately I can't do IIF(Fields!margin.Value > Last(Fields!margin.Value, "GroupByItem") because records could easily contain the same values.
Does anyone have any tips?
Thanks in advance!
I am trying to make a query for approval of documents, where the result display the name and signature with date. How can I get the date for two people approving the document?
Select Uname
case when stepcode=1 then 'approver1' end as 'name of person'
case when stepcode=1 then 'approver1' end as ' date of signed noted'
case when stepcode=2 then 'approver2' end as 'date of signed approved'
from table
I tried this, but only one result showed up. Only the name, signature and date of the first approval displayed.
We can only answer this by making some assumptions:
the field stepcode denotes what stage of the sign off process the record is at
value of 1 means noted and value 2 means approved. A value of 0 means nothing has happened yet
approver1 and approver 2 are NULL if the action has not yet taken place
If all of the above is true, then there should be no requirement to have a CASE statement for the fields... just including the fields within the SELECT statement will bring the values through if they have been completed.
Some validation of data might be required here though if you are not getting the results you are expecting. Running some rough counts for each of the steps and for where they have values in the approver fields would help to make sure your code is working. The following should give you something to work with:
SELECT
stepcode
COUNT(TableID) AS NumberAtStep
FROM table
GROUP BY stepcode
Using these counts, you can then run your statement without the CASE statements and run a manual count to ensure you are seeing the right number of records with the relevant populated columns for each step.
Further information will be required to delve into your problem further however
Scenario:
I have a single table in access 2007 with few columns and several thousand records which I have imported form a CSV file via a “DoCmd” statement.
What I want:
I want to export these records but on a basis of specific field content and with another column’s date basis. i.e. I want to export the records with the “EQ” ( content of a columns field “SERIES”) and with a date which is one amongst the many dates the column have.
The “SERIES”, I have defined in “Criteria” in my query and it is working fine as the “SERIES” remains the same every day.
Issues:
The problem is with the date that changes every month and I cannot define or hard-code it in anywhere.
Query is working fine with the file where there is no date, but with a date, it is an issue.
Question:
Can we put a user define textbox, where user can define the date and that date will be taken by the query and will return the records with that defined date? In addition, “SERIES” is already defined in query so the result will be exact.
I use the following statement for exporting the data:
DoCmd.TransferText acExportDelim, "NewFnoSpec", "fnoquery",
"C:\Users\welcome\Desktop\Output.txt", True
Using the following 'WHERE' clause as a starting point to select records for one specific date:
WHERE (((Table1.SERIES)="First") AND ((Table1.MyDate)=#4/4/2014#));
You can prompt the user to enter a date by using:
WHERE (((Table1.SERIES)="First") AND ((Table1.MyDate)=[Enter Date]));
If there was some pattern or rule as to the desired date (i.e. first day of prior month, first Monday of prior month, etc.) you could structure the 'WHERE' clause to handle that without a prompt.
Thank you for your reply and an answer. Your answer is quite helpful. I have tried a little easier way and it worked for me. I put a text box named txtexpdate, on the form and in the query ( design mode ), in criteria I have put this :
Like "" & [Forms]![Futures]![txtexpdate] & ""
This is working fine at this juncture. And thank you once again for your efforts to answer my question. Hope this also will help others as an option to this problem.
Regards
Achal
I need your help.
The following is my database table.
http://i42.tinypic.com/10xh4j7.png
A small request to please have a look at the image.
My problem is, when I want to retrieve the rate from date_from and date_to.
For Eg: Lets say retrieving_date = 2013-11-14.
rs = stat.executeQuery("select rate from rate_chart where '"+retrieving_date+"' BETWEEN date_from AND date_to");
This query gives me my required result, for the 11th month.
I get 10.40 as my required rate with the above query.
Lets say, rate has never been changed since 2013-11-26, and now my retrieving_date is 2013-12-20. And now, when I try to execute the above query, it doesn't work. No errors but doesn't give me the last rate. In my case, is 10.80 as mentioned in the above image.
I actually want to search between dates even if the stop date or (date_to) is null.
No, idea how to go forth with this. Stuck for a while now.
Any help would be greatly appreciated.
if the stop date (or date_to) is null, set it to the current date.
I have an Access 2000 report based on a query like this
SELECT
...
FROM Clients AS wc INNER JOIN ...
WHERE ((wo.OfferStatusID)=3) AND
((DatePart("ww",[wo.StatusTimeStamp]))=DatePart("ww",[Enter Week End Date]))
AND ((Year([wo.StatusTimeStamp]))=Year(Date())));
The where clause allows you to enter the 'Week End Date' and it finds all of the records for the Sunday-Saturday week that contains the end date.
My problem is I need to include the Saturday end date on the report so that the header reads '... for week ending 5/9/09' and I can't figure out how to get that date without the query asking me for it a second time.
Is there a way to force Access to return the parameter entered as another field in the results, or another way to get that week ending date?
Continuing to poke around in the query designer I discovered that I could add this to the SELECT clause and get the value entered added to each row:
[Enter Week End Date] AS WeekEndDate
This works, but I am still open to other suggestions.
You could stack two queries (make one the source of the other). This would be pretty MS Access'y. However, if you have it working now, I'd stick with what you have. It's probably cleaner.
Another approach is to use a form to grab the query params first, and reference the form control in the query. For instance, with your example, create a form called frmGetDateParam, and add a textbox called txtDate. Change the format to a date, perhaps add some validation, doesn't matter. Add a command button to the form which opens up the report. Then, change your query to look like this :-
SELECT
...
FROM Clients AS wc INNER JOIN ...
WHERE ((wo.OfferStatusID)=3) AND
((DatePart("ww",[wo.StatusTimeStamp]))=DatePart("ww",Forms!frmGetDateParam!txtDate))
AND ((Year([Forms!frmGetDateParam!txtDate]))=Year(Date())));
You can also reference Forms!frmGetDateParam!txtDate as a field on your report.
The only downside to this approach is that if you try to open the query/report without the parameter form being open, then the query will still prompt you for the date value.