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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mypowerbi1
Helper III
Helper III

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 @mypowerbi1 ,

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 @mypowerbi1 ,

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.

mypowerbi1
Helper III
Helper III

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 @mypowerbi1 
Why is adding a classified column (to the data table) problematic?

Ritaf1983
Super User
Super User

Hi @mypowerbi1 
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

 



Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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