Forum Discussion

saipawar's avatar
saipawar
Icon for Helper IV rankHelper IV
6 years ago
Solved

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 NameLink to content
A1on hold
B1https://lorenipsum1111
C1on hold - needs funding
D1 https://lorenipsum2222
E1in process - waiting for location
F1in 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