Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
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 April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
107 | |
68 | |
48 | |
47 | |
44 |