Forum Discussion
Jensej
5 years agoHelper V
CASE WHEN THEN in Measure
Hello everyone! Trying to create a measure with the IF or Switch function but can't make it work. Can someone please help me to rewrite this so it works in a measure: SUM(
CASE WHEN a....
- 5 years ago
Can you try the following formula:
Measure = ( SUMX ( Sheet1, -- Table Name IF ( Sheet1[accountNr1] = Sheet1[accountNr], CALCULATE(SUM ( Sheet1[Amount ] )), 0) ) ) - SUMX ( Sheet1, -- Table Name IF ( Sheet1[accountNr2] = Sheet1[accountNr], CALCULATE(SUM ( Sheet1[Amount ] )), 0) ) ))*-1
themistoklis
5 years agoCommunity Champion
Can you try the following formula:
Measure = (
SUMX (
Sheet1, -- Table Name
IF (
Sheet1[accountNr1] = Sheet1[accountNr],
CALCULATE(SUM ( Sheet1[Amount ] )),
0)
)
)
-
SUMX (
Sheet1, -- Table Name
IF (
Sheet1[accountNr2] = Sheet1[accountNr],
CALCULATE(SUM ( Sheet1[Amount ] )),
0)
)
))*-1
Jensej
5 years agoHelper V
I made like this in end at it worked.
Measure =
VAR _A =
SUMX (
Sheet1, -- Table Name
IF (
Sheet1[accountNr1] = Sheet1[accountNr],
CALCULATE(SUM ( Sheet1[Amount ] )),
0)
)
VAR _B =
SUMX (
Sheet1, -- Table Name
IF (
Sheet1[accountNr2] = Sheet1[accountNr],
CALCULATE(SUM ( Sheet1[Amount ] )),
0)
)
Return ( _A - _B ) * 1