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,
So I have a huge table with repeating patients for a hospital. I want to know when the DATEDIFF (in days) between the time they got discharged and the time they came back and readmitted. Not sure if you can see, but in the example (screenshot) below, this patient was first discharged on Sept 5th, 2018, but then came back on September 9th, 2018 (4 days difference). Then, they got discharged on September 10th, and then readmitted on September 30th (20 days difference). I want to know the interval in days between those two dates. Therefore, it has to be a DATEDIFF column or measure between two columns and different rows. Is this doable?
@Anonymous
Try this as calculated column
Calc Column = VAR PreviousRow = TOPN ( 1, FILTER ( Table1, [Name] = EARLIER ( [Name] ) && [Discharge Date] < EARLIER ( [Discharge Date] ) ), [Discharge Date], DESC ) VAR PreviousDischargeDate = MAXX ( PreviousRow, [Discharge Date] ) RETURN DATEDIFF ( PreviousDischargeDate, [Admission date], DAY )
@Zubair_Muhammad it kind of worked..but is it possible to have the first admission date as 0? I am not sure what value it is yielding since it is the first admission date and there are no prior discharge date.
@Anonymous
Sorry for late reply. I had to go out
When I use your sample data I get correct results....the first entry shows blank
See the pic below
@Zubair_Muhammad Not exactly sure why I have values. I will try to figure it out. Thanks for your help!
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 |
---|---|
113 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |