IF else in Calculate in Dax

85 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 best solutions below

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