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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
CSUbux8
New Member

Group data by column headers in data source

I am trying to create groups using coumn headers if possible.

 

I have a single row of data points for each CustomerID with many column headers. I would like to create some "buckets" or groups of products but the data source i have does not give me the ability to create a relationship to another table with the buckets and what products fall into those groups/buckets of products. For example:

                          Total   Sales         Product 1        Product 2        Product 3        Product 4

Customer 1        $xxxxx                     x                                               x

Customer 2        $xxxxx                                              x                      x                       x

 

Can i create groups of products using the column headers of products?

 

Tech Products = Product 1 and Product 2

Farming Products = Product 3 and Product 4

 

Hope that makes sense 🙂

2 REPLIES 2
dax
Community Support
Community Support

Hi @CSUbux8 ,

You could try to unpivot column , then add custom column to group data, then you could get the group, and you could put this column in "Column field" of Matrix.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTI0AhJGxkAChM2VYnWilZJAPBDX0BAkCSLMDZRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [name = _t, p1 = _t, p2 = _t, p3 = _t, p4 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"name", type text}, {"p1", Int64.Type}, {"p2", Int64.Type}, {"p3", Int64.Type}, {"p4", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"name"}, "Attribute", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Columns", "Custom", each if [Attribute] ="p1" or [Attribute] ="p2" then "g1" else "g2")
in
    #"Added Custom"

Best Regards,
Zoe Zhi

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

VasTg
Memorable Member
Memorable Member

@CSUbux8 

 

If you want to group values, you could create them with right click on value-> create group.

 

If you expect to show the group in matrix, please refer to this post.

 

https://community.powerbi.com/t5/Desktop/Group-Measures/m-p/852275

 

If this helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

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.

Top Solution Authors