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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
raviqul
Frequent Visitor

How To transform table columns into matrix

Hi Power BI Experts,

 

I'm trying to create a matrix like a picture below 

raviqul_0-1609990415036.png

 

From a table with format like this : 

raviqul_1-1609990497221.png

 

well i already try to utilize pivot-unpivot column function and such.. but still confused how to properly use it

is there anyway to solve it ?

Thanks 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can do this in the query editor.  Since you shared an image of your table and not something easily pasted, specific M code isn't given.  However, these are the steps:

 

1. Select your project column, right click and choose "unpivot other columns"

2. Select the new Attribute column and in the ribbon choose split by and enter a space (and do it only at the first delimiter)

3. Rename your columns to what you want

4. Use the column that has Revenue, Cost, Net Income on rows in a matrix visual.  Put the column with Actual To Date, etc. in for columns, and put the Value column in the Values area with a Sum aggregation

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

You can do this in the query editor.  Since you shared an image of your table and not something easily pasted, specific M code isn't given.  However, these are the steps:

 

1. Select your project column, right click and choose "unpivot other columns"

2. Select the new Attribute column and in the ribbon choose split by and enter a space (and do it only at the first delimiter)

3. Rename your columns to what you want

4. Use the column that has Revenue, Cost, Net Income on rows in a matrix visual.  Put the column with Actual To Date, etc. in for columns, and put the Value column in the Values area with a Sum aggregation

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi @mahoneypat thanks for your solution.. it does give me the solution .. great 

amitchandak
Super User
Super User

@raviqul , This like split of measure into measure and dimesnion.

In matrix you have an option "Show on Row", but that will not help.

 

You have create a table with union and summarize

 

example

union(
summarize("Measure","Share of Voice", "YTD",[Share of Voice YTD], "LYTD",[Share of Voice LYTD], "Change %",[Share of Voice %]),
summarize("Measure","SOV Rank", "YTD",[SOV Rank YTD], "LYTD",[SOV Rank LYTD], "Change %",[SOV Rank %])
)

 

Or

union(
summarize('Table',"Measure","Min","Test1",min('Table'[Test1]),"Test2",min('Table'[Test2]),"Test3",min('Table'[Test3]))
summarize('Table',"Measure","Max","Test1",max('Table'[Test1]),"Test2",max('Table'[Test2]),"Test3",max('Table'[Test3]))
)

 

Add the group by if you need filter in new table, Use this one for display.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

hello @amitchandak  thanks for the respond.. I already tried your solution and the result table is like picture below 

 

raviqul_0-1610321068893.png

why the columns shown like that? is it because union that cost column merge into revenue?

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.