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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
jpvernon67
Frequent Visitor

Time from hospital discharge to first follow up appointment

Relatively new to DAX and I am struggling to get my head around the solution to this problem. I have searched for a solution but nothing seems to fit,

 

I have 3 tables:

 

Patient provide this has the unique client ID in it

 

Hospital discharge table has the unique client ID, discharge date. Has many values for the same client ID - I have no control over this table. Comes from the hospital.

Schedule data also has the client ID, appointment dates, appointment types. This also has many fields.

There is no direct link other than client ID between these 2 tables. i.e there is no 'event ID' that would connect it to the associated follow up appointment.

 

What I need to get is the number of days from the patient's discharge date to the first outpatient appointment date (can't be the same day)

 

The results would look something like this:

Client IDDischarge DateFollow Up DateDays
1123451/1/20221/5/20224
432354/1/20224/7/20226
5326233/12/20223/14/20222
644522/14/20222/18/20224
4267783/11/20223/20/20229
  Median Days4

 

What I need for the report is the row total days and the aggregate median days per period FY, FYQ,...

 

Any insight would be very appreciated

3 REPLIES 3
jpvernon67
Frequent Visitor

Sorry about that

 

here is a link to the files:

 

https://1drv.ms/u/s!AptRNMy-TRKq4wvd6mrjQTUyIacP?e=y2mWAY

 

Here is what the output should look like:

PatientIDEventDischarge DateFollow Up DateDays
54918Emergency Discharge4/17/20214/28/202111
55069Emergency Discharge4/17/20214/26/20219
55079Emergency Discharge4/17/20214/22/20215
40509Emergency Discharge4/19/20214/29/202110
42195Emergency Discharge4/19/20214/28/20219
15283Inpatient Discharge01/31/2022  

 

it is also possible that the person did not have a follow up appointment like patient 15283. I should be able to get the median days to follow up by both patient and as an aggregate by time period.

Shishir22
Solution Sage
Solution Sage

Hello @jpvernon67 ,

 

Request you to please provide sample data of all the tables and expected result so that we can help you.

 

Thanks,

Shishir

Cheers,
Shishir

here is a link to the files:

 

https://1drv.ms/u/s!AptRNMy-TRKq4wvd6mrjQTUyIacP?e=y2mWAY

 

Here is what the output should look like:

PatientIDEventDischarge DateFollow Up DateDays
54918Emergency Discharge4/17/20214/28/202111
55069Emergency Discharge4/17/20214/26/20219
55079Emergency Discharge4/17/20214/22/20215
40509Emergency Discharge4/19/20214/29/202110
42195Emergency Discharge4/19/20214/28/20219
15283Inpatient Discharge01/31/2022  

 

it is also possible that the person did not have a follow up appointment like patient 15283. I should be able to get the median days to follow up by both patient and as an aggregate by time period.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.