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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.