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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Matti78
New Member

How to change colums to rows and current rows to colums DAX

Hello,

 

I have been wondering how to change colums to rows and vice versa. I have tried to check community and see if i find something from youtube, but with no luck.

 

I have this kind of table:

Table1

SystemHoursWeighted averageProject1Project2Project3Project4Project5
Sub111516,530,86 %17,37,7225,3411,68 
Sub233749,04 %  6,55  
Sub36833,4518,31 %13,72,1413,73  
Sub48931,523,93 %16 16,32  
Sub529537,91 %  5,93  
Sub62219,55,95 %3,9 4,46  
Sub7484,51,30 %  0,13  
Sub8651,51,75 %     
Sub9354,40,95 %     

 

 and i would like to create new table where data would be like this:

Table2

Projectsub1sub2sub3sub4sub5sub6sub7sub8sub9
Project117,3 13,716 3,9   
Project27,72 2,14      
Project325,346,5513,7316,325,934,460,13  
Project411,68        
Project5         

 

I have tried summarize command, but i did not manage get dax code correctly.

 

Any help with this issue?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Matti78 

You can refer to the following example

1.Create a table

vxinruzhumsft_0-1682390145654.png

2.Then create a measure

Measure = var _project1=SUMMARIZE('Table',[Project1],[System],"Projects","Project1")

var _project2=SUMMARIZE('Table',[Project2],[System],"Projects","Project2")

var _project3=SUMMARIZE('Table',[Project3],[System],"Projects","Project3")

var _project4=SUMMARIZE('Table',[Project4],[System],"Projects","Project4")

var _project5=SUMMARIZE('Table',[Project5],[System],"Projects","Project5")

var _table= UNION(_project1,_project2,_project3,_project4,_project5)

return SUMX(FILTER(_table,[System] in VALUES('Table'[System])&&[Projects] in VALUES('Table (2)'[Column1])),[Project1])

3.Select matrix visual, then put the column of table2 to row, put system of table to column, then put measure to the value.

Output

vxinruzhumsft_1-1682390469418.png

 

Best Regards!

Yolo Zhu

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

 

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, select the first 3 columns, right click and select "Unpivot Other Columns".  Rename the Attribute column to Projects.  Build your visual from this transformed table

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Matti78 

You can refer to the following example

1.Create a table

vxinruzhumsft_0-1682390145654.png

2.Then create a measure

Measure = var _project1=SUMMARIZE('Table',[Project1],[System],"Projects","Project1")

var _project2=SUMMARIZE('Table',[Project2],[System],"Projects","Project2")

var _project3=SUMMARIZE('Table',[Project3],[System],"Projects","Project3")

var _project4=SUMMARIZE('Table',[Project4],[System],"Projects","Project4")

var _project5=SUMMARIZE('Table',[Project5],[System],"Projects","Project5")

var _table= UNION(_project1,_project2,_project3,_project4,_project5)

return SUMX(FILTER(_table,[System] in VALUES('Table'[System])&&[Projects] in VALUES('Table (2)'[Column1])),[Project1])

3.Select matrix visual, then put the column of table2 to row, put system of table to column, then put measure to the value.

Output

vxinruzhumsft_1-1682390469418.png

 

Best Regards!

Yolo Zhu

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

 

Hello,

 

I added measure code 4 new projects same way as you discriped in your earlier message, but for some reason it dosen't freshresh those 4 new projects to matrix table. Any idea how to fix it?

 

Measure 2 =

var _project1=SUMMARIZE('Weighted average',[Project1],[System],"Projects","Project1")

var _project2=SUMMARIZE('Weighted average',[Project2],[System],"Projects","Project2")

var _project3=SUMMARIZE('Weighted average',[Project3],[System],"Projects","Project3")

var _project4=SUMMARIZE('Weighted average',[Project4],[System],"Projects","Project4")

var _project5=SUMMARIZE('Weighted average',[Project5],[System],"Projects","Project5")

var _project6=SUMMARIZE('Weighted average',[Project6],[System],"Projects","Project6")

var _project7=SUMMARIZE('Weighted average',[Project7],[System],"Projects","Project7")

var _project8=SUMMARIZE('Weighted average',[Project8],[System],"Projects","Project8")

var _project9=SUMMARIZE('Weighted average',[Project9],[System],"Projects","Project9")

var _project10=SUMMARIZE('Weighted average',[Project10],[System],"Projects","Project10")

var _project11=SUMMARIZE('Weighted average',[Project11],[System],"Projects","Project11")

var _project12=SUMMARIZE('Weighted average',[Project12],[System],"Projects","Project12")

var _project13=SUMMARIZE('Weighted average',[Project13],[System],"Projects","Project13")

var _table= UNION(_project1,_project2,_project3,_project4,_project5,_project6,_project7,_project8,_project9,_project10,_project11,_project12,_project13)

return SUMX(FILTER(_table,[System] in VALUES('Weighted average'[System])&&[Projects] in VALUES(Progress[System])),[Project1])

Thank you very much!!!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.