Forum Discussion
LuBS
3 years agoRegular Visitor
Time difference for each Status in Power Bi
I have a date column, status column, a reportID column, and other columns (not important for the calculation I am having trouble with) like this reportID | date | Status 1 | date1 | ...
Anonymous
2 years agoNot applicable
Hi LuBS ,
You can create a calculated column as below to get it, please find the details in the attachment.
Column =
VAR _predate =
CALCULATE (
MAX ( 'Table'[date] ),
FILTER (
'Table',
'Table'[reportID] = EARLIER ( 'Table'[reportID] )
&& 'Table'[date] < EARLIER ( 'Table'[date] )
&& 'Table'[Status] <> EARLIER ( 'Table'[Status] )
)
)
RETURN
DATEDIFF ( _predate, 'Table'[date], DAY )
Best Regards