Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have put together the following custom column in power query editor, and it generates a "Token ',' expected" error on it, and I cant actually see where I have went wrong with the code, show error highlights the first IN. Thanks if anyone has any advice to help!
SWITCH(TRUE(),
[priority_cd] IN {"A_1HRE", "B_6HRE"}
AND [class] IN {"3", "4", "8"}
AND ISNULL([need_cat], "AAA") <> "GAR"
AND [ord_status] <> "CAN"
AND ISNULL([ord_stage], "AAA") NOT IN {"CNA", "CNI", "CTR", "CWA", "DUP", "TRC"}, "Emergency",
[priority_cd] NOT IN {"A_1HRE", "B_6HRE"}
AND [class] IN {"3", "4", "8"}
AND ISNULL([need_cat], "AAA") <> "GAR"
AND [ord_status] <> "CAN"
AND ISNULL([ord_stage], "AAA") NOT IN {"CNA", "CNI", "CTR", "CWA", "DUP", "TRC"}, "NonEmergency",
[class] NOT IN {"3", "4", "8"}
OR ISNULL([need_cat], "AAA") = "GAR"
OR [ord_status] = "CAN"
OR ISNULL([ord_stage], "AAA") IN {"CNA", "CNI", "CTR", "CWA", "DUP", "TRC"}, "Other"
)
Solved! Go to Solution.
Hi,
I am not sure if PowerQuery supports SWITCH, you will need to used nested if.
Alternatively you can use Data view and write a DAX function to insert a new column; the above query should work if replace AND by && , OR by ||
Regards
Hi,
I am not sure if PowerQuery supports SWITCH, you will need to used nested if.
Alternatively you can use Data view and write a DAX function to insert a new column; the above query should work if replace AND by && , OR by ||
Regards
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 20 | |
| 14 | |
| 11 | |
| 10 | |
| 9 |