Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator III
Creator III

Max Record

HI All,

How to get max date record..

   

IDDatesales
1001/1/20141000
1001/15/20142500
1002/2/2015100
1012/3/2015890
1015/13/2015259
1025/15/2015500
1025/16/201590

My output should be..

   

IDDatesales
1002/2/2015100
1015/13/2015259
1025/16/201590

Thanks

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Maybe like

...

Left JOIN (YourTable)

LOAD ID,

       Date(Max(Date)) as Date,

      1 as Flag

RESIDENT YourTable

GROUP BY ID;

RESULT:

LOAD ID, Date, Sum(sales) as sales

RESIDENT YourTable

WHERE Flag =1

GROUP BY ID, Date;

DROP TABLE YourTable;

View solution in original post

6 Replies
Kushal_Chawda
MVP
MVP

Create the Straight Table

Dimension : ID

Expression :

Date : FirstSortedValue(Date, -Date)

Sales : FirstSortedValue(Sales, -Date)

swuehl
Champion III
Champion III

If you want a script solution:

LOAD ID,

          LastValue(Date) as Date,

          LastValue(Sales)

RESIDENT YourTable

GROUP BY ID

ORDER BY ID, Date asc;

DROP TABLE YourTable;

Chanty4u
MVP
MVP

plz chk

paulwalker
Creator III
Creator III
Author

Thanks for Quick response....

Suppose some times i have data like this..

IDDatesales
1001/1/20141000
1002/2/20152500
1002/2/2015100
1012/3/2015890
1015/13/2015259
1025/15/2015500
1025/16/201590

My output should be..

  

IDDatesales
1002/2/20152600
1015/13/2015259
1025/16/201590

Thanks...

swuehl
Champion III
Champion III

Maybe like

...

Left JOIN (YourTable)

LOAD ID,

       Date(Max(Date)) as Date,

      1 as Flag

RESIDENT YourTable

GROUP BY ID;

RESULT:

LOAD ID, Date, Sum(sales) as sales

RESIDENT YourTable

WHERE Flag =1

GROUP BY ID, Date;

DROP TABLE YourTable;

paulwalker
Creator III
Creator III
Author

Thank You