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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SanderBI
Frequent Visitor

Create matrix table

I'm trying to create a matrix table to work with in my report e.a. in my charts. 

 

See below's example. On the left my current table and on the right the result I want. I've tried a few things in the query editor and using DAX. However, I did not get the result I want. I know I can create such a table easely in my report but then I cannot use is in other visuals.

 

The categories are dynamic so I cannot hard code these columns names. 

 

Can someone help me out?

 

Create matrix.PNG

 

 

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

Hi @SanderBI ,

 

As @Anonymous , we can pivot your table in power query. Here I create one sample for your reference. M code  as below.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMLRQ0lFyBGJDpVgdFEEnIDZCF3QGYmOooBGydhN0QZB2U3RBkHYzpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Dates = _t, Categories = _t, Values = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Dates", type date}, {"Categories", type text}, {"Values", Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Categories]), "Categories", "Values", List.Sum)
in
    #"Pivoted Column"

Capture.PNG

 

Pbix as attached.

 

Regards,

Frank

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @SanderBI ,

 

As @Anonymous , we can pivot your table in power query. Here I create one sample for your reference. M code  as below.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMLRQ0lFyBGJDpVgdFEEnIDZCF3QGYmOooBGydhN0QZB2U3RBkHYzpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Dates = _t, Categories = _t, Values = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Dates", type date}, {"Categories", type text}, {"Values", Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Categories]), "Categories", "Values", List.Sum)
in
    #"Pivoted Column"

Capture.PNG

 

Pbix as attached.

 

Regards,

Frank

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

@SanderBI,

You can pivot your table in query editor to get the desired result.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.