Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
jenniferrayner
Frequent Visitor

Comparing Volume by Dates

I need to develop a visual to show the number of patients admitted compared to the number of patients discharged by month, year.  I have the admission and discharge dates in the same table, and currently this is connected to a separate Date Table using the discharge date.   The issue I'm having is with the date table that drives the months.  How do I show two different date ranges in one chart?   For example 500 people can admit on Jan 5, and 450 people can discharge on Jan 5 - each set has unique dates. 

 

 Sample DataSample Data

 

I tried separating the Admission data into a unique table and connecting that to the Date tabel using the Admission date, but It didn't help. 

 

I considered not using a Date Table, but then I'm still stuck with the date issue since I need to have one for the visual.

 

Thank you.

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

Create a non-active relationship (Many to One and Single) from the Admission date to the Date column of the Calendar Table.  To your visual, drag Year and Month name from the Calendar Table.  Write these measures

Discharged = distinctcount(Data[Patient ID])

Admitted = calculate([discharged],userelationship(Data[Admission date],Calendar[date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

I got it.  Needed to remove [Date] from the compelte date.

Thank you!

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Create a non-active relationship (Many to One and Single) from the Admission date to the Date column of the Calendar Table.  To your visual, drag Year and Month name from the Calendar Table.  Write these measures

Discharged = distinctcount(Data[Patient ID])

Admitted = calculate([discharged],userelationship(Data[Admission date],Calendar[date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

I appreciate the assistance.

When creating the Admitted measure, I'm getting the followng error: USERELATIONSHIP function can only use the two columns references participating in relationship.

 

Admitted Vol = CALCULATE('Disch Opt Data'[Discharged Vol],USERELATIONSHIP('Disch Opt Data'[Admit Date Time],'Date Table'[Complete Date].[Date]))
 
Any ideas?

I got it.  Needed to remove [Date] from the compelte date.

Thank you!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@jenniferrayner , I think you should consider date table with Active/Inactive join here and create meausre using userelationship

 

consider

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.