Forum Discussion
question about switch
I have a requirement where I have to match one expression with multiple values (from syntax below)
SWITCH(<expression>, <value>, <result>[, <value>, <result>]…[, <else>])
I am writing a psuedocode of exactly what I am looking for, Question is, how do i match one <expression> with more than one values for<value> in above syntax
IF column IN ('a','b','c','d','e','f') -- 1
THEN
IF (column2 like '%tst%' OR column IN ('a','b') ) -- 2 THEN
IF column IN ('d','e') THEN
[use this column];
ELSIF column IN ('b','d','e','f') THEN
[use this column];
END IF;
ELSE -- 2
0
END IF; -- 2
END IF; -- 1
6 Replies
- v-juanli-msftCommunity Support
Hi Anonymous
Create measures
Measure 1 = IF(ISERROR(SEARCH("tst",MAX(Sheet7[column2]),1)),0,SEARCH("tst",MAX(Sheet7[column2]),1)) Measure = IF ( MAX ( Sheet7[column] ) IN { "a", "b", "c", "d", "e", "f" }, IF ( [Measure 1] <> 0 || MAX ( Sheet7[column] ) IN { "a", "b" }, IF ( MAX ( Sheet7[column] ) IN { "d", "e" }, [use this column], IF ( MAX ( Sheet7[column] ) IN { "b", "d", "e", "f" }, [use this column] ) ), 0 ) )Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Thank you for your response
- AnonymousNot applicable
How can I write a calculated column, instead of a measure
- v-juanli-msftCommunity Support
Hi Anonymous
Create columns
Column 2 = IF(ISERROR(SEARCH("tst",Sheet7[column2],1)),0,SEARCH("tst",Sheet7[column2],1)) Column 3 = IF ( Sheet7[column] IN { "a", "b", "c", "d", "e", "f" }, IF ( [Column 2] <> 0 || Sheet7[column] IN { "a", "b" }, IF ( Sheet7[column] IN { "d", "e" }, [use this column], IF ( Sheet7[column] IN { "b", "d", "e", "f" }, [use this column] ) ), 0 ) )Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.