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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

how to club columns in category

Hi,

Is there any way to clubbed multiple columns in the categories to show them in matrix visual.

As like below, Column1 and Column2 in Category A, Column3 and Column4 in Category B and Column5 in Category 😧

 

mypowerbi1_0-1685709126136.png

Thanks

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, here's my solution.

Sample:

vyanjiangmsft_0-1686041425038.png

1. In Power Query, select the columns(column1 to column5) then click "Unpivot Columns"

vyanjiangmsft_1-1686041494079.png

Result:

vyanjiangmsft_2-1686041588028.png

2. Create a calculated column "Category".

Category =
SWITCH (
    'Table'[Attribute],
    "Column1", "Category A",
    "Column2", "Category A",
    "Column3", "Category B",
    "Column4", "Category B",
    "Column5", "Category C"
)

3. In matrix, put Date in Rows, Category and Attribute in Columns, Value in Values, then click expand.

vyanjiangmsft_3-1686041877486.png

Result:

vyanjiangmsft_4-1686041963994.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, here's my solution.

Sample:

vyanjiangmsft_0-1686041425038.png

1. In Power Query, select the columns(column1 to column5) then click "Unpivot Columns"

vyanjiangmsft_1-1686041494079.png

Result:

vyanjiangmsft_2-1686041588028.png

2. Create a calculated column "Category".

Category =
SWITCH (
    'Table'[Attribute],
    "Column1", "Category A",
    "Column2", "Category A",
    "Column3", "Category B",
    "Column4", "Category B",
    "Column5", "Category C"
)

3. In matrix, put Date in Rows, Category and Attribute in Columns, Value in Values, then click expand.

vyanjiangmsft_3-1686041877486.png

Result:

vyanjiangmsft_4-1686041963994.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @Ritaf1983 ,

These are simple columns which have no hierarchy. we need to provide them categories and show relevant columns under those categories on matrix column.

Thanks

 

Thanks

Hi @Anonymous 
Why is adding a classified column (to the data table) problematic?

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Ritaf1983
Super User
Super User

Hi @Anonymous 
If your columns are hierarchies of category and subcategory, just put a hierarchy on columns and open it:

Ritaf1983_0-1685794628870.png

In the other case if there are subcategories of measures you can use text boxes / shapes up to needed columns

Ritaf1983_2-1685794947693.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 



Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

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