Forum Discussion
fisqkuz1
4 years agoFrequent Visitor
measure with multiple if statements
hi all coming from a python background, i am trying to get the hang of dax. however I am having trouble with the following attempt: Revenue or Cost = IF(table[col] = "short" & table[col2...
- 4 years ago
Hi, fisqkuz1
Try measure formula like the following:
Measure = var _col=MAX('Table'[col]) var _col2=MAX('Table'[col2]) return SWITCH(TRUE(), _col="short"&&_col2>0,2, _col="short"&&_col2<>0,1, _col="long"&&_col2>0,1, _col="long"&&_col2<>0,2, 2 )If it doesn't work, pelase share your sample data and expected result in excel.
Best Regards,
Community Support Team _ Eason
v-easonf-msft
Community Support
4 years agoHi, fisqkuz1
Try measure formula like the following:
Measure =
var _col=MAX('Table'[col])
var _col2=MAX('Table'[col2])
return
SWITCH(TRUE(),
_col="short"&&_col2>0,2,
_col="short"&&_col2<>0,1,
_col="long"&&_col2>0,1,
_col="long"&&_col2<>0,2,
2
)
If it doesn't work, pelase share your sample data and expected result in excel.
Best Regards,
Community Support Team _ Eason