Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
Am pretty new to DAX and am really struggling with creating this formula,
What I need to achieve is I need to check multiple codes in a Colum and if they match the criteria then it would display the text that I need. But then if they don’t match if would check the next lot of codes. So it’s like IF OR statement in excel.
I Have a COLUM that looks like this which is called SDCC,
SDCC |
ONL |
MIP |
ABZ |
MXX |
TDX |
REK |
CVG |
AKL |
GTW |
AMM |
ALG |
In more details i would need create a measure that would match ONL, MIP, ABZ MXX then display the text that I would need but if it does not match, then go onto the next check of codes AKL, GTW, AMM, ALG then display my text.
below is the code that I used between two tables but I could only check one value “REK” this is what I am struggling with…. I am not sure how to check multiple references. I bet it’s something very simple and am overthinking it maybe.
CONTAINS3 = IF(CONTAINS(RELATEDTABLE(Sheet1), test[CODE], "REK"),
"CVG",
""
)
I also tried creating a new custum colum by using this
if [SDCC] = "ATH" and [SDCC] = "BAH" and [SDCC] = "BAK" and [SDCC] = "BEG" and [SDCC] = "BLR"
then "CVG"
else if [SDCC] = "BRU" and [SDCC] ="CAI" and [SDCC] ="DHA" and [SDCC] = "JNB"
then "LEJ"
else "Range Unknown"
Thanks in advance for the help!
Solved! Go to Solution.
Hi @Anonymous
You may try to use IN Function.For example:
Column = IF ( Table1[SDCC] IN { "ATH", "BAH", "BAK", "BLR" }, "CVG", IF ( Table1[SDCC] IN { "BRU", "CAI", "DHA", "JNB" }, "LEJ", "Range Unknown" ) )
Regards,
Cherie
So, you can use "||" for OR criteria (&& for AND). But, I would use a SWITCH, not nested IF statements.
Do you have any examples for using SWITCH? and thank you for your response.
Hi @Anonymous
You may try to use IN Function.For example:
Column = IF ( Table1[SDCC] IN { "ATH", "BAH", "BAK", "BLR" }, "CVG", IF ( Table1[SDCC] IN { "BRU", "CAI", "DHA", "JNB" }, "LEJ", "Range Unknown" ) )
Regards,
Cherie
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |