Forum Discussion
Calculate difference between values in same column
- Anonymous2 years ago
I found the solution!
thought I'd share it with you, sice you've all been so helpfull.
Gereden km's tussen tankbeurten =
VAR CurrentVehicle = 'F: Tankgegevens'[Voertuignummer]
VAR CurrentDate = 'F: Tankgegevens'[Datum]
VAR CurrentKM = 'F: Tankgegevens'[KM-stand]VAR PreviousKM =
CALCULATE(
MAX('F: Tankgegevens'[KM-stand]),
FILTER(
'F: Tankgegevens',
'F: Tankgegevens'[Voertuignummer] = CurrentVehicle &&
'F: Tankgegevens'[Datum] < CurrentDate
)
)RETURN
IF(
NOT ISBLANK(PreviousKM),
CurrentKM - PreviousKM,
BLANK()
)
I found the solution!
thought I'd share it with you, sice you've all been so helpfull.
Gereden km's tussen tankbeurten =
VAR CurrentVehicle = 'F: Tankgegevens'[Voertuignummer]
VAR CurrentDate = 'F: Tankgegevens'[Datum]
VAR CurrentKM = 'F: Tankgegevens'[KM-stand]
VAR PreviousKM =
CALCULATE(
MAX('F: Tankgegevens'[KM-stand]),
FILTER(
'F: Tankgegevens',
'F: Tankgegevens'[Voertuignummer] = CurrentVehicle &&
'F: Tankgegevens'[Datum] < CurrentDate
)
)
RETURN
IF(
NOT ISBLANK(PreviousKM),
CurrentKM - PreviousKM,
BLANK()
)