Forum Discussion
In need help with a measure for difference between two rows
- 1 year ago
RobBeijers312 Try using this version
Accrual =
VAR CurrentYear = MAX('Table'[year])
VAR PreviousYear = CurrentYear - 1
VAR CurrentEntitlement =
CALCULATE(
SUM('Table'[totalentitlementhours]),
'Table'[year] = CurrentYear
)
VAR PreviousBalance =
CALCULATE(
SUM('Table'[leavehoursbalance]),
'Table'[year] = PreviousYear
)
RETURN
IF(
ISBLANK(PreviousBalance),
BLANK(),
CurrentEntitlement - PreviousBalance
)
Hi bhanu_gautam ,
Thanks for the reply.
Currently the outcome of the measure is the sum of totalentitlementhours. So it seems that the problem lies with the formula of the PreviousBalance. When I only return PreviousBalance the outcome is unfortunately blank.
RobBeijers312 Try using this version
Accrual =
VAR CurrentYear = MAX('Table'[year])
VAR PreviousYear = CurrentYear - 1
VAR CurrentEntitlement =
CALCULATE(
SUM('Table'[totalentitlementhours]),
'Table'[year] = CurrentYear
)
VAR PreviousBalance =
CALCULATE(
SUM('Table'[leavehoursbalance]),
'Table'[year] = PreviousYear
)
RETURN
IF(
ISBLANK(PreviousBalance),
BLANK(),
CurrentEntitlement - PreviousBalance
)
- RobBeijers3121 year agoHelper I
bhanu_gautam thanks, it works!