Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Value on Max and Min Date Not Working

unitkeydate
150A5/17/2009
225A6/29/2009
300A10/19/2009
100B2/16/2008
200B4/16/2008
300B7/13/2008

Dear all,

I have the above set of data and what would like to achieve is to have the value of unit in the max and min date for each of the key, which is shown as below.

keyunit at max dateunit at min date
A300150
B300100

But what I get is

keyunit at max dateunit at min date
A0150
B0100

I tried to use set analysis but I can't figure out the way to do it. The expressions I used are

sum(if(date=aggr(max(total<key> date),key),unit))

sum(if(date=aggr(min(total<key> date),key),unit,0))

Attached is the qvw file. Would you please help?

12 Replies
tresesco
MVP
MVP

Try:

FirstSortedValue(unit, date)  //min

FirstSortedValue(unit, -date)  //max

rbecher
MVP
MVP

Hi Ivy,

you can use set analysis:

sum({<date={'$(=min(date))'}>} unit)

sum({<date={'$(=max(date))'}>} unit)

- Ralf

Astrato.io Head of R&D
Not applicable
Author

It works! Thanks a lot. I wonder why mine working working? Also, could it be done using set analysis?

jyothish8807
Master II
Master II


PFA

Regards

KC

Best Regards,
KC
jyothish8807
Master II
Master II

Hi Tresco,

Will it work if the date order is suffeled in the source sheet?

Regards

KC

Best Regards,
KC
tresesco
MVP
MVP

Yes, it will.

Not applicable
Author

Thanks Ralf. It seems that using set analysis is not working properly

Not applicable
Author

It is what I get using set analysisplan.bmp

jyothish8807
Master II
Master II

Try using my attachment.Logic is little different in that.

Regards

KC

Best Regards,
KC