Forum Discussion
zombieug
8 years agoHelper I
Calculate Column based on different Values
Hi forum :smileyhappy: I would appreciate your help on the following matter: down below you can see an example table. I would like to calculate the column Lifecycle based on: partnumber & th...
- 8 years ago
Try this Calculated Column
LifeCycle = VAR CurrentDate = TableName[Date] VAR PreviousDate = CALCULATE ( MAX ( TableName[Date] ), FILTER ( ALLEXCEPT ( TableName, TableName[PartNumber] ), TableName[Action] = "Install" && TableName[Date] < CurrentDate ) ) RETURN IF ( NOT ( ISBLANK ( PreviousDate ) ) && TableName[Action] = "Install", DATEDIFF ( PreviousDate, CurrentDate, DAY ) )
Zubair_Muhammad
8 years agoCommunity Champion
Try this Calculated Column
LifeCycle =
VAR CurrentDate = TableName[Date]
VAR PreviousDate =
CALCULATE (
MAX ( TableName[Date] ),
FILTER (
ALLEXCEPT ( TableName, TableName[PartNumber] ),
TableName[Action] = "Install"
&& TableName[Date] < CurrentDate
)
)
RETURN
IF (
NOT ( ISBLANK ( PreviousDate ) )
&& TableName[Action] = "Install",
DATEDIFF ( PreviousDate, CurrentDate, DAY )
)- zombieug8 years agoHelper I