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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Solved! Go to Solution.
Hi @Anonymous
the first part has random non-DAX code like "starts with". For the secodn part, you'd need something like this. You'll probably have to adapt it a bit but you'll get the idea.
Category =
VAR cat_raw = 'Data'[Category_Raw]
VAR new =
SWITCH (
TRUE (),
AND (
'Data'[Facility] = "BC",
OR ( 'Data'[Type] = "YYYY", 'Data'[Type] = "YXYX" )
), "YContainer",
AND ( 'Data'[Facility] = "CD", 'Data'[Type] = "CDCD" ), "DContainer",
cat_raw
)
RETURN
new
Look at the syntax of SWITCH to understand well how it works
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
@Anonymous
Can you explain with a short sample table, so we can understand the code.
Regards
Paul
@Anonymous
1) Let me see the actual code.
2) Check that none of the columns you are comparing to text are of type boolean
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
All my columns are of type TEXT, i have checked it already
Hi @Anonymous
the first part has random non-DAX code like "starts with". For the secodn part, you'd need something like this. You'll probably have to adapt it a bit but you'll get the idea.
Category =
VAR cat_raw = 'Data'[Category_Raw]
VAR new =
SWITCH (
TRUE (),
AND (
'Data'[Facility] = "BC",
OR ( 'Data'[Type] = "YYYY", 'Data'[Type] = "YXYX" )
), "YContainer",
AND ( 'Data'[Facility] = "CD", 'Data'[Type] = "CDCD" ), "DContainer",
cat_raw
)
RETURN
new
Look at the syntax of SWITCH to understand well how it works
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Sorry about the non dax part, it was for my understanding which i will do it later , to search and to use contain in dax query .So for the time being i am using "=" only , and i also tried removing the IF statements and i am still getting the same error
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 14 | |
| 14 | |
| 12 | |
| 7 | |
| 6 |