Forum Discussion
Anonymous
7 years agoNot applicable
DATEDIFF Between Two Columns for Same Value
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 ...
Zubair_Muhammad
Community Champion
7 years agoAnonymous
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 )