Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello everybody, how are you?
I need your help urgently for a problem I'm having.
I have a column with different values, but with a specific string that repeats in more than one row.
What do I need to do?
I need to categorize these specific strings into 3 different categories, which are the regions that each location equals.
I am trying to use SWITCH with CONTAINSSTRING, because I need it to return the text I want in the calculated column if it finds the text I am looking for.
But it is not working. Can anyone help me and tell me where I am going wrong, or any alternative way for me to get what I want?
Solved! Go to Solution.
Hi @matheus_peppers ,
Here are the steps you can follow:
1. Create calculated column.
Column =
SWITCH(
TRUE(),
CONTAINSSTRING('Table'[Anuncio],"Taubate")=TRUE(),"Taubate",
CONTAINSSTRING('Table'[Anuncio],"Canas")=TRUE(),"Canas")
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @matheus_peppers ,
Here are the steps you can follow:
1. Create calculated column.
Column =
SWITCH(
TRUE(),
CONTAINSSTRING('Table'[Anuncio],"Taubate")=TRUE(),"Taubate",
CONTAINSSTRING('Table'[Anuncio],"Canas")=TRUE(),"Canas")
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@matheus_peppers , You should use Switch (True(),
and then you can check for true in each expression
Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
19 | |
17 | |
11 | |
9 | |
9 |