Forum Discussion
Siboska
3 years agoHelper II
Calculate datediff between groups and ID
Hi, I need to calculate the DateDiff between different periods grouped by ID and per group. Data looks like this: The measure must caluclate the datediff on planned end date per Pr...
Anonymous
3 years agoNot applicable
Hi Siboska ,
Try using this by creating new column.
DateDiff Column =
VAR PreviousDate =
CALCULATE (
LASTDATE ( Sheet1[Planned End date] ),
ALLEXCEPT ( Sheet1, Sheet1[Stage] ),
Sheet1[Planned End date] < EARLIER ( Sheet1[Planned End date] )
)
VAR CurrentDate = Sheet1[Planned End date]
RETURN
IF ( ISBLANK ( PreviousDate ), 0, DATEDIFF ( PreviousDate, CurrentDate, DAY ) )
Best Regards,
Shreya Mukkawar
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
- Siboska3 years agoHelper II
Hi,
Thx for reply.
It is not neccesory Earlier or LastDate. The planned End date can move both backwards and forwards. So think we somehow need to incorporate the index collumn in order to tell Power BI in which order to compare?