Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi
I need to help to make a count of patients that are in beds each day in hospitals. My data looks like this:
Hospital Patient_ID Admission_date Discharge_date
HospitalA 1 10.05.2021 13.05.2021
HospitalB 2 11.05.2021 16.05.2021
HospitalA 3 08.05.2021 15.05.2021
My expected output is like this:
date count_of_patients
07.05.2021 0
08.05.2021 1
09.05.2021 1
10.05.2021 2
11.05.2021 3
12.05.2021 3
13.05.2021 3
14.05.2021 2
15.05.2021 2
16.05.2021 1
and my final diagram is like this with possibility to have a slicer for hospital :
How can I make a measure in DAX that gives me what I want?
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Patient Count: =
CALCULATE (
COUNTROWS ( Data ),
FILTER (
Data,
Data[Admission_date] <= MAX ( 'Calendar'[Date] )
&& Data[Discharge_date] >= MIN ( 'Calendar'[Date] )
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
Please check the below picture and the attached pbix file.
Patient Count: =
CALCULATE (
COUNTROWS ( Data ),
FILTER (
Data,
Data[Admission_date] <= MAX ( 'Calendar'[Date] )
&& Data[Discharge_date] >= MIN ( 'Calendar'[Date] )
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
This solution worked out beautifully. Simple, but truly effective solution. Thanks a lot !!!
@danguy2099 , one of these two blogs on mine should help you
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
51 | |
46 | |
39 | |
19 | |
19 |