ifelse statement in DAX

31 views Asked by At

I am trying to create a calculated column using the code below. Lookup function works find until I added the IF statement above it. What I need is to fix the outcome to 1 when df[col] = "B0" or df[col] = "B1" otherwise outcome should give the lookup function result. how to get around with this ? many thanks in advance.

_FY23_AOP_Rate = 
 IF('df'[col] = "B0" || 'df'[col] = "B1", 
    1, 
    LOOKUPVALUE(
                    dimFX[FY23 AOP], 
                    dimFX[Currency Code], 'df'[Currency])
  
)
1

There are 1 answers

2
davidebacci On BEST ANSWER

Are you just missing an enclosing quote after B1?

IF('df'[col] = "B0" || 'df'[col] = "B1", 
    1, 
    LOOKUPVALUE(
                    dimFX[FY23 AOP], 
                    dimFX[Currency Code], 'df'[Currency])
  
)