Forum Discussion
lathaaa
4 years agoFrequent Visitor
IF condition based on two columns
Hi All, need help on writing DAX the logic should be if that particular ID is only Failed - 0, only Success - 1, Success & failed - 2, Success & Failed & reprocess - 3 the expected column should be...
AntonioM
4 years agoSolution Sage
Please give this a try
Column =
var statuses = CALCULATETABLE( VALUES('Table'[Status]), ALL('Table'[Status]) )
return
SWITCH(
TRUE(),
CONTAINS(statuses,'Table'[Status], "reprocess") && CONTAINS(statuses,'Table'[Status], "Failed") && CONTAINS(statuses,'Table'[Status], "Success"),
3,
CONTAINS(statuses,'Table'[Status], "Failed") && CONTAINS(statuses,'Table'[Status], "Success"),
2,
CONTAINS(statuses,'Table'[Status], "Success"),
1,
CONTAINS(statuses,'Table'[Status], "Failed"),
0
)Which will give you