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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Create slicer groups by selecting columns

Hello,

I have the following table and i am trying to present the data in a stacked column visualization with grouping selectable in a slicer based on specific columns.

The X axis is the week number and the Y axis shows the number of items according to each category.

The 3 groupings should be:

1. Warehouse: Stock and Returns

2. Dock: Defective and Sold

3. Transport: Excess and Expired.

These 3 groupings should be in a slicer, so when "Warehouse" is selected, it should filter out the chart to only show Stock and Returns. Is this possible? Any help is much appreciated!

 

YearWeek numberStockReturnsDefectiveSoldExcessExpired
202213482811
2022269176210
2022325103612
2022493163512
2022556157315
2022622102311
2022778229319
2022833134713
2022963187218
20221033148914
20221127175217
20221237223621

 

The chart with the data from the table:

 

MakeItReal_1-1659538837963.png

 

I have tried to make a group from the Fields area but it is not working. It should allow selecting the column names instead of showing the values in that column.

MakeItReal_0-1659538823312.png

 

1 ACCEPTED SOLUTION

For that to work you need to change your data model. Unpivot the source data and add the categories there.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZZDNDoIwDMdfxezMgVXn4K4voAdjCAeFmhAUDaDx8e22Ninx8M/68WvXtqrMGS+jycwJsV8N78cVg3ecn01P7wHn9zhMZO3whs3cfTBkn/eWnv23wWmKxqsbsTV1VhnIAShkSWvShlSQgF9rNRW0JZUh49mJ5bnG1hx1KZMCAbWgsQ13Clm7ZcP9YY4VGwTDS43TmIwC8qlMslzBs+KSoCcoNVZwNGbkMD45Civ544gVjEBy9HVz3U5uXCZHc5bLvRzYST+/4GQ3L1vIhYGWrX8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t, Column7 = _t, Column8 = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {"Year", "Week number"}, "Channel", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "Category", each if List.Contains({"Stock","Returns"},[Channel]) then "Warehouse" else if List.Contains({"Defective","Sold"},[Channel]) then "Dock" else "Transport"),
    #"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"Category", type text}, {"Value", Int64.Type}})
in
    #"Changed Type"

see new version attached

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Instead of the three groups you need to create three measures.  If you want you can also create a disconnected table with these three choices and then tie the measure result to the selected value. Or use the fancy new Field Parameters.

lbendlin_0-1659923969618.png

see attached.

Anonymous
Not applicable

Hi @lbendlin Thanks for your reply! The new Field Parameters escaped me! But is it possible to show the categories for each grouping in a legend?

 

For example, when "Warehouse" is selected, the graph should look as follows:

MakeItReal_0-1659946838022.png

 

For that to work you need to change your data model. Unpivot the source data and add the categories there.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZZDNDoIwDMdfxezMgVXn4K4voAdjCAeFmhAUDaDx8e22Ninx8M/68WvXtqrMGS+jycwJsV8N78cVg3ecn01P7wHn9zhMZO3whs3cfTBkn/eWnv23wWmKxqsbsTV1VhnIAShkSWvShlSQgF9rNRW0JZUh49mJ5bnG1hx1KZMCAbWgsQ13Clm7ZcP9YY4VGwTDS43TmIwC8qlMslzBs+KSoCcoNVZwNGbkMD45Civ544gVjEBy9HVz3U5uXCZHc5bLvRzYST+/4GQ3L1vIhYGWrX8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t, Column7 = _t, Column8 = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {"Year", "Week number"}, "Channel", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "Category", each if List.Contains({"Stock","Returns"},[Channel]) then "Warehouse" else if List.Contains({"Defective","Sold"},[Channel]) then "Dock" else "Transport"),
    #"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"Category", type text}, {"Value", Int64.Type}})
in
    #"Changed Type"

see new version attached

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.