Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld online is next week! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
baylor2016
Creator
Creator

How to get date for a max value in straighttable?

Hi,

I need to get the date for Max value by different users. In my example, I would like to know when is the patient's highest BMI.

Here is the data table.

   

IDpat_idDateBMI
111/1/201630
211/2/201739
311/3/201820
421/4/201628
521/5/201724
621/6/201833
731/7/201128
831/8/201240
931/9/201536
1031/10/201747
1131/11/201328
1241/12/201427
1341/13/201544
1441/14/201637
1541/15/201735
1641/16/201831

The max BMI date for pat_id 1 is 1/2/2017, and for pat_id 2 is 1/8/2018.

I tried to use max({<BMI={"=max(BMI)"}>}Date), it just returns the max date - not the date for max BMI.

Please advise.

The same project attached.

Thanks

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Try this for your Max BMI date

= Firstsortedvalue(Date(Date,'M/D/YYYY'), -Aggr(Max(BMI), pat_id, BMI))

View solution in original post

2 Replies
vishsaggi
Champion III
Champion III

Try this for your Max BMI date

= Firstsortedvalue(Date(Date,'M/D/YYYY'), -Aggr(Max(BMI), pat_id, BMI))

baylor2016
Creator
Creator
Author

Thank you! It works perfectly. Could you give some explanations?