Forum Discussion
cqueiroz2222
1 year agoHelper I
Adding an IF condition to a Measure
Hello, I am trying to reply an Excel Rule into DAX Measure The idea is: When Result < 0, sum Result + Last Month C/C (superior line), otherwise, just reply the result So just reply the result wh...
Angith_Nair
1 year agoContinued Contributor
You can try the below dax:
C/C =
VAR _Current = 'Table'[Result]
VAR _MaxMonth = MAXX(ALL('Table'), 'Table'[Month])
VAR _Previous =
CALCULATE (
SUM ( 'Table'[Result] ),
FILTER ( 'Table', 'Table'[Month] < EARLIER ( 'Table'[Month] ) )
)
RETURN
IF (
'Table'[Month] = _MaxMonth && _Current < 0,
_Current,
_Current + COALESCE ( _Previous, 0 )
)cqueiroz2222
1 year agoHelper I