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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggregate using latest value

Hi..

Is there a way to do aggregation using the latest value. I have a table list statues of orders by date. what I need is to count the number of orders at the end of the selected period according to their latest status.

So Suppose I have this table

   

Order_noStatusDate
1Received01/01/2016
1Under process02/01/2016
1Completed02/01/2016
2Received02/01/2016
2Under process02/01/2016
2Under process03/01/2016
3Received02/01/2016
3Completed03/01/2016

if my date filter selected all dates less than or equal 03/01/2016 I would expect to get

Received 0>>>>> (for non)

Completed 2 >>>>> (for 1 and 3)

Under process 1 >>>>> (for 2)

however

if my date filter selected all dates less than or equal 02/01/2016 I would expect to get

Received 2>>>>> (for 2 and 3)

Completed 1 >>>>> (for 2)

Under process 2 >>>>> (for 1 and 2)



I have tried to use this code but it gave me an error


=Count({$<Date = {'$(=aggr(max(Date),Order_no))'} >} distinct Order_no)


any help from you

2 Replies
MayilVahanan

Hi,

Are you looking like this?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

sorry I cannot open the file as I have the free version right now. could you please post the script over here.