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

distinct value with max date

Hi all,

I am trying to solve a problem. I have the following table.

1.PNG

Now, I would like to have only distinct serialnumbers with max date associated with them like shown below:

2.PNG

Any help is appreciated.

Thank you,

Parth

1 Solution

Accepted Solutions
maxgro
MVP
MVP

in script


SET DateFormat='M/D/YYYY';

a:

load * inline [

SerialNumber, Date

abcd,6/5/2014

efgh,7/15/2015

xyz,3/2/2013

pqr,4/16/2015

abcd,9/2/2015

xyz,5/15/2015

pqr,9/3/2015

];

inner Join (a)

load

  SerialNumber, date(max(Date)) as Date

Resident a

Group By SerialNumber;



or if you want in chart


dimension    SerialNumber

expression    max(Date)

View solution in original post

2 Replies
maxgro
MVP
MVP

in script


SET DateFormat='M/D/YYYY';

a:

load * inline [

SerialNumber, Date

abcd,6/5/2014

efgh,7/15/2015

xyz,3/2/2013

pqr,4/16/2015

abcd,9/2/2015

xyz,5/15/2015

pqr,9/3/2015

];

inner Join (a)

load

  SerialNumber, date(max(Date)) as Date

Resident a

Group By SerialNumber;



or if you want in chart


dimension    SerialNumber

expression    max(Date)

Not applicable
Author

Thank you very much Massimo. This helped me.

Have a good one

Regards,

Parth