Forum Discussion
Anonymous
4 years agoNot applicable
Multiple criteria for switch statement
I'm really struggling to get my head round this SWITCH statment, may not be possible in one calculated column? I've written it in SQL below as a case statment and it works but cant do the same in DAX...
- 4 years ago
Hi Anonymous
This is a formula for a calculated columnSwitch Statement = SWITCH ( TRUE (), TableName[A] = BLANK () && TableName[B] IN { 1, 2, 3, 4, 5 }, "Global", TableName[A] IN { 11, 12, 13 } && OR ( TableName[B] = BLANK (), TableName[B] = 6 ), "Local", TableName[A] = BLANK () && OR ( TableName[B] = BLANK (), TableName[B] = 6 ) && NOT ( RELATED ( DIM[C] ) IN { 98, 99 } ), "Customer", TableName[A] = BLANK () && OR ( TableName[B] = BLANK (), TableName[B] = 6 ) && RELATED ( DIM[C] ) = 98, "Other", "NA" )
Anonymous
4 years agoNot applicable
Amazing, thank you!!