IF else in Calculate in Dax

70 views Asked by At

I have a simple calculation MyBase = SUM('MyData'[Amount]) and I would like to include an ifelse statement in Calculate. The condition is IF [Currency Type] = "USD" THEN [MyBase]/2 Otherwise print out the code below.

MyCalculate = 
CALCULATE(    
    [MyBase],
    KEEPFILTERS('MyData'[Currency] = "USD"),
    KEEPFILTERS('MyData'[Scenario] = "AOP")
    )
1

There are 1 answers

0
davidebacci On BEST ANSWER
IF(
'MyData'[Currency] = "USD", 
[MyBase]/2, 
CALCULATE(    
    [MyBase],
    KEEPFILTERS('MyData'[Currency] = "USD"),
    KEEPFILTERS('MyData'[Scenario] = "AOP")
    )
)