Forum Discussion

jaw19883's avatar
jaw19883
Frequent Visitor
5 years ago
Solved

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