Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Find Max Date for each Item with its coresponding value

Hello everyone,

I have a table with following three field

ItemValueDate
A20003/06/2014
A1001/02/2014
B4505/08/2013
B3601/04/2014

and my query is to display a table as follow

ItemValuedate
A20003/06/2014
B3601/04/2014

Thanks in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Use Item as dimension, the expression max(Date) to find the maximum date and the expression firstsortedvalue(Value, -Date) to find the value corresponding with the maximum date. Note, Date should be a field with real date values. If the field contains string values then you'll have to create dates from them first in the script: date#(Date, 'MM/DD/YYYY') as Date. Or maybe you need DD/MM/YYYY as date format. I can't tell from your data.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Use Item as dimension, the expression max(Date) to find the maximum date and the expression firstsortedvalue(Value, -Date) to find the value corresponding with the maximum date. Note, Date should be a field with real date values. If the field contains string values then you'll have to create dates from them first in the script: date#(Date, 'MM/DD/YYYY') as Date. Or maybe you need DD/MM/YYYY as date format. I can't tell from your data.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you Gysbert..:)