Forum Discussion
jemartin
7 years agoNew Member
DAX Calculate if statement
Hi, I am pretty new with DAX and struggling to translate this excel formula into DAX format. I want to calculate the Value based on the criteria; Sales price * qty (where Sales price >0) Bud...
- 7 years ago
jemartin add new column using following expression:
HVIS = SWITCH(
TRUE(), Table[Sales Price] > 0, Table[Sales Price] * Table[Qty], Table[Sales Price] = 0 && Table[Budget Price] = 0, Table[Material Cost] * 0.3 * Table[Qty], Table[Sales Price] = 0, Table[Budget Price] * Table[Qty] )change column name and table name as per your data model. You can also achieve it with IF but Switch is easy to change/read.
parry2k
Super User
7 years agojemartin add new column using following expression:
HVIS = SWITCH(
TRUE(), Table[Sales Price] > 0, Table[Sales Price] * Table[Qty], Table[Sales Price] = 0 && Table[Budget Price] = 0, Table[Material Cost] * 0.3 * Table[Qty], Table[Sales Price] = 0, Table[Budget Price] * Table[Qty] )
change column name and table name as per your data model. You can also achieve it with IF but Switch is easy to change/read.