Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
baylor2016
Contributor

How to get summary from firstsortedvalue?

Hi,

I was able to get the last BMI status (underweight, healthy weight, overweight and obesity) by using FirstsortedValue for each patients by using PAT_NAME AND PAT_ID as dimension,

=FirstSortedValue( distinct
{$<YearMonth,
BMI={'>0'},
VISITTYPE={'Office visit'},

CONTACT_DATE ={"$(='<=' & Date(enddateSelected))"}>} INTBMI, -CONTACT_DATE)

I would like to know how to get the summary for all the patients - the patient number for each BMI category. I thought it might need use AGGR function. But I have not clue how to get it done.

 

Please help.

 

Thanks

Labels (2)
1 Solution

Accepted Solutions

Re: How to get summary from firstsortedvalue?

Hi, maybe adding it as dimension:
=Aggr(FirstSortedValue( distinct
{$<YearMonth,
BMI={'>0'},
VISITTYPE={'Office visit'},
CONTACT_DATE ={"$(='<=' & Date(enddateSelected))"}>} INTBMI, -CONTACT_DATE), PAT_ID)

And Count(Distinct PAT_ID) as expression
2 Replies

Re: How to get summary from firstsortedvalue?

Hi, maybe adding it as dimension:
=Aggr(FirstSortedValue( distinct
{$<YearMonth,
BMI={'>0'},
VISITTYPE={'Office visit'},
CONTACT_DATE ={"$(='<=' & Date(enddateSelected))"}>} INTBMI, -CONTACT_DATE), PAT_ID)

And Count(Distinct PAT_ID) as expression
baylor2016
Contributor

Re: How to get summary from firstsortedvalue?

Great! Works perfectly!