Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table with a dimension (Clinic) and a measure (count of distinct patients who had a visit). How can I make the measure count patients only once in the table, for their most recent visit?
For example, the Clinic dimension has values 'Clinic A' and 'Clinic B.' If patient Mary went to both clinics, she should be counted in the 'Clinic A' row because she went there most recently.
In the data model, the fields are all in one table: Clinic, PatientID, VisitDate.
Should I use set analysis with Aggr?
You could try this expression:
=-SUM(Clinic=aggr(nodistinct FirstSortedValue(Clinic, -VisitDate),PatientID))
Thank you, @Vegar . I don't completely understand. Do you mean that can be my measure expression? Or is that set analysis inside of count(distinct PatientID)? It looks like set analysis but without {} and <> brackets.