cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
AlexG16261626
New Member

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors