Forum Discussion

jdb0912's avatar
jdb0912
New Member
3 years ago

Detailed report drill through on a date for value calculated using two date references (Census data)

Hi everyone,

 

I have a dataset of patients who visited a hospital, with an admit date and discharge date like so:

VisitIDAdmitDate

DischargeDate

11/1/2023

2/27/2023

21/1/2023

1/5/2023

31/2/2023

1/13/2023

41/3/2023

 

 

I have a calendar table with inactive relationships to both the admit and discharge date.

 

I have a measure within the calendar table to calculate the daily census using this formula:

 

DailyCensus = CALCULATE(DISTINCTCOUNT(Visits[VisitID]), Visits[AdmitDate] <= MAX(Calendar[Date]) && (Visits[DischargeDate] > MAX(Calendar[Date]) || ISBLANK(Visits[DischargeDate])))

 

 

 I have another measure to aggregate each daily census as an average using this formula:

 

AverageDailyCensus = AVERAGEX(Calendar, Calendar[DailyCensus])

 

 

I'm visualizing this data on a bar chart, with the date as the axis and average daily census as the values. I used the date hierarchy (year, month, day) which allows drilling down.

 

From this bar chart, I would like to design a drill through to a detailed page that reports all the patients who were considered in that bar. Using my sample data for example, if I drill through to the bar for January 2, 2023, I should get the following results:

VisitIDAdmitDate

DischargeDate

11/1/2023

2/27/2023

21/1/2023

1/5/2023

31/2/2023

1/13/2023

 

I tried doing it myself and made a page that allows drill through when any of the calendar dateparts in the hierarchy is used as a category. However, the drill through always returns all the visits, no matter what date I drill through.

 

Any assistance would be greatly appreciated.

 

Thanks!