Forum Discussion
Anonymous
2 years agoNot applicable
need help on how to implement case statement in DAX
Hi All Need help on how to write DAX for the below scenario i need to create a dax calcultions for calculated columns for below 1.case when Acc Number ='54112' then Amount 2.cas...
JTBusinessIntel
2 years agoHelper I
Good Morning, Anita,
You should be able to do this with a Switch(True()) function.
For a calulated column, your code should look something like this. :
Calculated Column =
SWITCH(
TRUE(),
TableName[Acc Number] = "54112", TableName[Amount],
TableName[Acc Number] in {"54112", "56019", "44291", "442901"}, TableName[Amount],
Blank())The syntax for a measure changes some, so be aware of that. I used TableName as a placeholder for whatever your table is called in your model.
I wasn't sure what your return value was for anything outside the parameters so I put a blank() to make it easy.
Hopefully this helps!
Thanks,
JTB