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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
baylor2016
Creator
Creator

How to summarize records by a field at Max date?

Dear all,

I have a table storing PCP changes per patients over time (see blow). I would like to summarize the patients by their last PCP. I was able to get the last PCP by using the =FirstSortedValue(PCP_PROV_ID2,-PCPSTARTDATE)  , but I cannot get the correct number of patients by last PCP.  I have tried to use Calculated dimension, aggr() in expression even set analysis, but the numbers are not correct. Please help. The sample project is attached.

Another question is how to add patients who have no PCP to the chart?

Thanks

Longmatch

   

PAT_IDPCP_PROV_ID2PCPSTARTDATEPCPENDDATE
Z365
Z6271169410/7/201112/26/2012
Z6271252212/27/20127/23/2013
Z627141197/24/2013
Z75460904/26/2010
Z78253154/14/20113/6/2013
Z7821167912/20/20103/8/2011
Z83553151/2/2014
Z883
Z90764975/20/2009
13 Replies
baylor2016
Creator
Creator
Author

Yes. A count for patients with null PCP_PROV_ID2 will be ok.

sunny_talwar

Just posted a solution above....

baylor2016
Creator
Creator
Author

Well done!

baylor2016
Creator
Creator
Author

Hi Sunny,

I posted another question about how to use dynamic set analysis and alternate state to build a cohort builder. Could you please review that post to see whether you can help me. Someone suggested to use And  mode, I do not think it is an ideal solution. Thanks as always.

Longmatch