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
Hi Gurus,
I created below formule, it alwasy return "YES" regardless. "Closed Order is a calculated column inside a tabel.
my 'SAP_WO'[PM_ORDER_SYSTEM_STATUS] columns data is like below
CLSD,NCMP,NMAT,PRC,SETC Returns "Yes" (correct result)
REL,ESTC,MACM,PRC,SETC Returns "Yes" (wrong result, should be "No"
Can you please help me out.
You have to think about what the switch is doing. It is finding the first TRUE() statement and returning the string.
ISERROR(SEARCH("CNF",'SAP_WO'[PM_ORDER_SYSTEM_STATUS])) , "Yes" is TRUE on every line that does not have "CNF" so it returns "YES".
What you want is this
Closed Orders =
SWITCH (
TRUE (),
NOT ISERROR ( SEARCH ( "CNF", 'SAP_WO'[PM_ORDER_SYSTEM_STATUS] ) ), "Yes",
NOT ISERROR ( SEARCH ( "TECO", 'SAP_WO'[PM_ORDER_SYSTEM_STATUS] ) ), "Yes",
NOT ISERROR ( SEARCH ( "CLSD", 'SAP_WO'[PM_ORDER_SYSTEM_STATUS] ) ), "Yes",
"No"
)
NOT ISERROR means it found the text in the string.
Hi,
Manged to get the desired result with CONTAINSTRING.
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 |
|---|---|
| 104 | |
| 82 | |
| 71 | |
| 50 | |
| 46 |