Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I have multiple values in one columnA like a, b, c, d and I would like to create a new columnB where I say
if columnA value contains[a,b,c ] then ColumnB = "1" and if Contains [f,g,h] then ColumnB = "2"
How can I write this DAX? I can do by IF and OR but that seems to be too long. is there any other keyword which can help me here. thanks
Solved! Go to Solution.
A SWITCH ( TRUE, .., ) is useful here.
ColumnB =
SWITCH (
TRUE (),
[ColumnA] IN { "a", "b", "c" }, "1",
[ColumnA] IN { "f", "g", "h" }, "2"
)
Note: I'm not sure I'm interpreting "columnA value contains[a,b,c ]" correctly though. Can you clarify?
A SWITCH ( TRUE, .., ) is useful here.
ColumnB =
SWITCH (
TRUE (),
[ColumnA] IN { "a", "b", "c" }, "1",
[ColumnA] IN { "f", "g", "h" }, "2"
)
Note: I'm not sure I'm interpreting "columnA value contains[a,b,c ]" correctly though. Can you clarify?
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
92 | |
83 | |
71 | |
49 |
User | Count |
---|---|
143 | |
121 | |
111 | |
59 | |
57 |