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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

IF calculation where IF dimension contains Text then Text (with ELSEIF conditions)

Hello!

 

I’m a Tableau user switching over to Power BI/DAX. I’m trying to replicate a Tableau calculation I had but having trouble figuring out the best approach in Power BI/Query. I am looking for an IF Contains THEN formula for multiple instances...

 

Here is the calculation in Tableau:

 

IF CONTAINS ([Campaign Name], “XYZ”) Then “XYZ Campaign”
ELSEIF CONTAINS ([Campaign Name], “ABC”) Then “ABC Campaign”

ELSEIF CONTAINS ([Campaign Name], “JKL”) Then “JKL Campaign”
END

 

 

Thanks!

1 ACCEPTED SOLUTION
vapid128
Solution Specialist
Solution Specialist

Switch(true(),
CONTAINS ([Campaign Name], “XYZ”) ,“XYZ Campaign”
CONTAINS ([Campaign Name], “ABC”) ,“ABC Campaign”
CONTAINS ([Campaign Name], “JKL”) ,“JKL Campaign”
"ELSE"
)

View solution in original post

1 REPLY 1
vapid128
Solution Specialist
Solution Specialist

Switch(true(),
CONTAINS ([Campaign Name], “XYZ”) ,“XYZ Campaign”
CONTAINS ([Campaign Name], “ABC”) ,“ABC Campaign”
CONTAINS ([Campaign Name], “JKL”) ,“JKL Campaign”
"ELSE"
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors