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
jaw19883
Frequent Visitor

Transform Data Source's Structure

I want to create a new table or rearrange the current data to a different structure. I am having to construct way too many measures and if I can rebuild the structure of the data in Power query, it will make what Im trying to complete easier, and I can scale it easier too.

I have no problem searching for the right video/blog post, etc. I just don't know the key words for what I am wanting to do. 

 

Background: My data source is an exported CSV/Excel file that is a gradebook from a course with test grades, quiz grades, notes grades, etc. It currently exports like this:  

StudentId             Unit 1 Quiz            Unit 1 Homework       Unit 1 Test       Unit 2 Quiz         Unit 2 Homework       Unit 2 Test
88888                     85                          82                                 93                        85                             100                        95
88887                     81                          92                                 83                        95                             100                        84
88886                     89                          72                                 97                        82                             100                        82

In my current setup (above) , I have 4 fields for every unit (Prerequisite, Quiz, Homework, Test) and I have to write a measure for each field. Each unit = 4 measures. In my test course, I have 12 units total, so that is 48 measures for 1 course! Each course is repeated 6 times and I have 8 different courses, so that is A LOT of measures. 

I want it to look like this:

 

StudentId             Quiz Name            Quiz Score       Test Name       Test Score         Homework Name       Homework Score
88888                    Unit 1 Quiz                 82                Unit 1 Test            93                        85                             100                        
88887                    Unit 1 Quiz                 81                Unit 1 Test            83                        95                             100                       
88886                    Unit 1 Quiz                89                 Unit 1 Test            97                        82                             100                        
88888                    Unit 2 Quiz                85                 Unit 2 Test            95                        85                             100                        
88887                    Unit 2 Quiz                95                 Unit 2 Test            84                        95                             100                        
88886                    Unit 2 Quiz               82                  Unit 2 Test            82                        82                             100                     

  

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jaw19883 , Please check this blog, seem like that should help help

https://kohera.be/power-bi/how-to-unpivot-twice/

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

View solution in original post

2 REPLIES 2
jaw19883
Frequent Visitor

@amitchandak This appears to have worked! Thank you for your quick and correct response! This is going to transform the design in this project. 

amitchandak
Super User
Super User

@jaw19883 , Please check this blog, seem like that should help help

https://kohera.be/power-bi/how-to-unpivot-twice/

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

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.