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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Create a new column with filtered data from another column

I have a table that has a column with brand names, for example Red1, Red2, Blue1, Blue2, Green1, Green2, Green3, that has corresponding data to each field that is presented in a new column,

I want to take, for example Red1 and Red 2 and combine them into Red and sum the corresponding data.

And I would also want to do the same with Blue1 and Blue2 and not show/remove Green1, Green2 and Green3 from the newly created column.  How do I do that? . If needed, I can try to explain in more details.

1 ACCEPTED SOLUTION

Hi @Anonymous

Do you mean this?

 

Group =
SWITCH (
    1;
    FIND ( "Red"; Table1[Brand]; 1; 0 ); "Red";
    FIND ( "Blue"; Table1[Brand]; 1; 0 ); "Blue";
    FIND ( "Green"; Table1[Brand]; 1; 0 ); "";
    "Other category"
)

It will assign "Other category" to anything that is not Red, Blue or Green.

 

View solution in original post

3 REPLIES 3
AlB
Super User
Super User

Hi @Anonymous

 

You could create a new column 'Group' in your table with something like this:

 

Group =
SWITCH (
    1;
    FIND ( "Red"; Table1[Brand]; 1; 0 ); "Red";
    FIND ( "Blue"; Table1[Brand]; 1; 0 ); "Blue";
    FIND ( "Green"; Table1[Brand]; 1; 0 ); "";
    BLANK ()
)

 

and then you can place a matrix visual on your report with:

1. Table1[Group] in rows and

2.   a measure like  this in 'values' of the matrix:

    MeasureCount=COUNT(Table1[Group]) 

 

 

Anonymous
Not applicable

@AlBThank you for the help! Is there any way to put all other extra data into one category of that column instead of manually typing Green 1, Green 2 etc. ?

Hi @Anonymous

Do you mean this?

 

Group =
SWITCH (
    1;
    FIND ( "Red"; Table1[Brand]; 1; 0 ); "Red";
    FIND ( "Blue"; Table1[Brand]; 1; 0 ); "Blue";
    FIND ( "Green"; Table1[Brand]; 1; 0 ); "";
    "Other category"
)

It will assign "Other category" to anything that is not Red, Blue or Green.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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