Forum Discussion
How to create case statement to group rows that have similar text?
Hi,
How can I create a case stament in Power BI to group specific rows.
I would like to create a pie chart or a bar chart that shows the status of customer's content by 3 categories -
1) On Hold
2)In Process
3)Completed (if the second column in the sample data below contains a url).
In a case statement I would have done something like this -
CASE
WHEN `Customer` LIKE "in pocess%" THEN "WIP"
WHEN `Customer1 LIKE "%HTTPS%" THEN "Completed"
ELSE
NA
How can I perform a similar query in Power BI?
Here's some sample data.
| Customer Name | Link to content |
| A1 | on hold |
| B1 | https://lorenipsum1111 |
| C1 | on hold - needs funding |
| D1 | https://lorenipsum2222 |
| E1 | in process - waiting for location |
| F1 | in process |
Appreciate your help.
Hi saipawar ,
We can create a calculated column to meet your requirement:
Category = IF ( CONTAINSSTRING ( [Link to content], "in process" ), "WIP", IF ( CONTAINSSTRING ( [Link to content], "https" ), "Completed", "NA" ) )
Best regards,
3 Replies
- VasTg
Memorable Member
Look into FIND or SEARCH dax commands and use them in SWITCH.
https://docs.microsoft.com/en-us/dax/search-function-dax
https://docs.microsoft.com/en-us/dax/find-function-dax
If it helps, mark it as a solution
Kudos are nice too. - v-lid-msft
Community Support
Hi saipawar ,
We can create a calculated column to meet your requirement:
Category = IF ( CONTAINSSTRING ( [Link to content], "in process" ), "WIP", IF ( CONTAINSSTRING ( [Link to content], "https" ), "Completed", "NA" ) )
Best regards,