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! Request now

Reply
Anonymous
Not applicable

add a column as header of another column in matrix

In matrix, the column name in blue background has data in database, and that of in gray is measure(percentage), so the original data is only a table.

If add a header which above them, how to add a column in table as a row in matrix  like that?

捕获.JPG

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see attachment), please check whether that is what you want.

1. Unpivot all columns whose names start with “M” in Power Query Editor

yingyinr_1-1648628556463.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WyixJzTUwVNJRMgViIyg2hmITpVgdqBIjqBIzIDYES0GUmCKUGCOZYopkEpISE6gJyNJmYDZciSmSEhMobQpWCldihmSJCZQNcVNsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [item = _t, M = _t, #"M+1" = _t, #"M+2" = _t, #"M+3" = _t, #"M+4" = _t, #"M+5" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"item", type text}, {"M", Int64.Type}, {"M+1", Int64.Type}, {"M+2", Int64.Type}, {"M+3", Int64.Type}, {"M+4", Int64.Type}, {"M+5", Int64.Type}}),
    #"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"M", "M+1", "M+2", "M+3", "M+4", "M+5"}, "Type", "Value")
in
    #"Unpivoted Only Selected Columns"

 

2. Create a matrix visual as below

yingyinr_0-1648628519237.png

In addition, you can also refer the following links to get it.

Power BI Unpivot (From Columns To Rows)

Convert multiple column data into a column with multiple rows

If the above one is not your expected one, please provide some sample data (exclude sensitive data) and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file with me. You can refer the following thread to upload your file in the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see attachment), please check whether that is what you want.

1. Unpivot all columns whose names start with “M” in Power Query Editor

yingyinr_1-1648628556463.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WyixJzTUwVNJRMgViIyg2hmITpVgdqBIjqBIzIDYES0GUmCKUGCOZYopkEpISE6gJyNJmYDZciSmSEhMobQpWCldihmSJCZQNcVNsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [item = _t, M = _t, #"M+1" = _t, #"M+2" = _t, #"M+3" = _t, #"M+4" = _t, #"M+5" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"item", type text}, {"M", Int64.Type}, {"M+1", Int64.Type}, {"M+2", Int64.Type}, {"M+3", Int64.Type}, {"M+4", Int64.Type}, {"M+5", Int64.Type}}),
    #"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"M", "M+1", "M+2", "M+3", "M+4", "M+5"}, "Type", "Value")
in
    #"Unpivoted Only Selected Columns"

 

2. Create a matrix visual as below

yingyinr_0-1648628519237.png

In addition, you can also refer the following links to get it.

Power BI Unpivot (From Columns To Rows)

Convert multiple column data into a column with multiple rows

If the above one is not your expected one, please provide some sample data (exclude sensitive data) and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file with me. You can refer the following thread to upload your file in the community. Thank you.

How to upload PBI in Community

Best Regards

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.


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
Top Kudoed Authors