Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gauravnarchal
Post Prodigy
Post Prodigy

Switch True

Hello - Instead of IN I want to add the condition contains in my measure. What condition can I use to make this work?

 

RETURN SWITCH ( TRUE(),

__PO IN { "MMS-NYC" } && __Reason = "MMS", "Missing"

1 ACCEPTED SOLUTION

I prefer CONTAINSSTRING in this situation since we don't care about the position of the substring.

 

To check if the variable __PO contains the string "MMS-NYC", you can write

CONTAINSSTRING ( __PO, "MMS-NYC" )

 

View solution in original post

2 REPLIES 2
Shahfaisal
Solution Sage
Solution Sage

You can use FIND function - https://learn.microsoft.com/en-us/dax/find-function-dax

Note -  FIND is case-sensitive. You can use SEARCH if you are looking for case-insensitive scenario - https://learn.microsoft.com/en-us/dax/search-function-dax

I prefer CONTAINSSTRING in this situation since we don't care about the position of the substring.

 

To check if the variable __PO contains the string "MMS-NYC", you can write

CONTAINSSTRING ( __PO, "MMS-NYC" )

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.