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
CMSGuy
Helper III
Helper III

How to normalize flat data

Good morning!  I have a table that contains flat data.  The table is a record of an employee and a certification they are working on.  Each day a daily record is entered indicating the employee, certification, and task.  Each certification can have a number of different tasks.  The flat table has up to 32 tasks (task names, tasks instances needed, task instances submitted).  I need to normalize that data for a matrix.  

 

This is a sample of the flat data:

Emp Full NameCertification IDCertification TitleTask 1Task 1 Instances SubmittedTask 1 Instances NeededTask 2Task 2 Instances SubmittedTask 2 Instances NeededTask 3Task 3 Instances SubmittedTask 3 Instances Needed

Michael D. Arksey3LG-8 GAS LINES CONSTRUCTION EQUIPMENT OPERATORMeter Turn On & Light Ups015Meter Exchanges015Meter Stand Relocate025
Christian J. Spencer3LG-8 GAS LINES CONSTRUCTION EQUIPMENT OPERATORMeter Turn On & Light Ups015Meter Exchanges015Meter Stand Relocate025
Brad K. Bagozzi Jr3LG-8 GAS LINES CONSTRUCTION EQUIPMENT OPERATORMeter Turn On & Light Ups015Meter Exchanges015Meter Stand Relocate025
Devin A. King3LG-8 GAS LINES CONSTRUCTION EQUIPMENT OPERATORMeter Turn On & Light Ups015Meter Exchanges015Meter Stand Relocate025
Joshua T. Diehl3LG-8 GAS LINES CONSTRUCTION EQUIPMENT OPERATORMeter Turn On & Light Ups015Meter Exchanges015Meter Stand Relocate025
Blayne J. Harper2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
James G. Delauter2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)160Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
Blayne J. Harper2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)160
Eric A. Roman2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)160Service Redline730CLIC (Plastic MAIN CREW 1-4 employees)060
Blayne J. Harper2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)160
Blayne J. Harper2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)160
Tony J. Jones2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
Tony J. Jones2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
Tony J. Jones2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
John G. Smith Jr2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
Aaron S. Allison2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
James G. Delauter2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)260Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
James G. Delauter2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
John G. Smith Jr2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)160
John G. Smith Jr2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
John G. Smith Jr2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)060
John G. Smith Jr2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)660Service Redline1130CLIC (Plastic MAIN CREW 1-4 employees)160
Eric A. Roman2LG-12 GAS LINES CONSTRUCTION WORKERCLIC (Plastic SERVICE CREW (1-4 employees)060Service Redline030CLIC (Plastic MAIN CREW 1-4 employees)160

 

Now what is ultimately needed is a normalized table to show:

  • Employee
  • Certification ID
  • Task Number
  • Task ID (or name)
  • Instances Needed
  • Instances Submitted

I am pretty sure that somehow the data needs a pivot, but unsure as to how to do it.  Thanks for any help or direction

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@CMSGuy Try this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("7ZZNU4MwEIb/yg4nnVEGUKtXSjMV2kIlVA/VQ4bulIxp0gnUsf56Q+vHQXtyqqAewiXL5nmzu9mdTq0RzwuGAno2+Pq+xLV1ZJ2YNewfX0DfpzAMY0IhSGKapZMgC5MYyNUkHI9InEEyJqmfJan5YYQVashWWkIi4XblOF4HhnxeVDBZlsbAMcs9e7Mkj+ZgOcdPtmjF5AxSFCpnFb7se2fW3dHUCgrNy4ozCZENdIkyR91w5K5mMxjY0GVz9fTEIWo6cA8fuATfhgGX84azRqosVgwyG3ocC9Fw2q5ga4l16l4yvdxkrrfFdb1dvDdJOiA1YzAMAzgYC2byPwdK0uswIBCk5AYO3ONTwMVSqDViefhyaKf+UNQPPEcDNBNcvvKcOB8cjvww3nrb5Wxz32yBJfTNdaNgq2qfEtw9SWhpENx3BUQbU1OfqVow+SMBOP/bAWi/gkzJdc0fKbl5xNqA7/zjNwM/UoWsewBd8KrYzjMtU+AzrSRQM/QKwUu1x0f0FzRir/0S/ithVyNoqYL2x+BHFHR2K3Ddr6TRN42ke6mCu2c=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Emp Full Name" = _t, #"Certification ID" = _t, #"Certification Title" = _t, #"Task 1" = _t, #"Task 1 Instances Submitted" = _t, #"Task 1 Instances Needed" = _t, #"Task 2" = _t, #"Task 2 Instances Submitted" = _t, #"Task 2 Instances Needed" = _t, #"Task 3" = _t, #"Task 3 Instances Submitted" = _t, #"Task 3 Instances Needed" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Emp Full Name", type text}, {"Certification ID", Int64.Type}, {"Certification Title", type text}, {"Task 1", type text}, {"Task 1 Instances Submitted", Int64.Type}, {"Task 1 Instances Needed", Int64.Type}, {"Task 2", type text}, {"Task 2 Instances Submitted", Int64.Type}, {"Task 2 Instances Needed", Int64.Type}, {"Task 3", type text}, {"Task 3 Instances Submitted", Int64.Type}, {"Task 3 Instances Needed", Int64.Type}}),
    Task1 = 
            Table.SelectColumns(#"Changed Type",{"Emp Full Name", "Certification ID", "Certification Title", "Task 1", "Task 1 Instances Submitted", "Task 1 Instances Needed"}),
    Task2 = Table.SelectColumns(#"Changed Type",{"Emp Full Name", "Certification ID", "Certification Title", "Task 2", "Task 2 Instances Submitted", "Task 2 Instances Needed"}),
    Task3 = 
        Table.SelectColumns(#"Changed Type",{"Emp Full Name", "Certification ID", "Certification Title", "Task 3", "Task 3 Instances Submitted", "Task 3 Instances Needed"}),
    #"Append" = 
        Table.Combine({Task1, Task2, Task3})
in
    #"Append"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Teskevm
Regular Visitor

do you mean like this?

Teskevm_0-1663600758274.png

This will take some more manual work then the other option but is more normalized!
You can probably automate it as well but that will take some more research 🙂

Yes, that is what I need.  How did you do it?

@CMSGuy The code I posted does this. Just paste it into a blank query using Advanced Editor and you can step through it.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks Greg!  It does work and I assume then I would just change the source to the real source, which is a SharePoint list.  And then I need to work in the remaining 30 tasks 🙂 

Greg_Deckler
Community Champion
Community Champion

@CMSGuy Try this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("7ZZNU4MwEIb/yg4nnVEGUKtXSjMV2kIlVA/VQ4bulIxp0gnUsf56Q+vHQXtyqqAewiXL5nmzu9mdTq0RzwuGAno2+Pq+xLV1ZJ2YNewfX0DfpzAMY0IhSGKapZMgC5MYyNUkHI9InEEyJqmfJan5YYQVashWWkIi4XblOF4HhnxeVDBZlsbAMcs9e7Mkj+ZgOcdPtmjF5AxSFCpnFb7se2fW3dHUCgrNy4ozCZENdIkyR91w5K5mMxjY0GVz9fTEIWo6cA8fuATfhgGX84azRqosVgwyG3ocC9Fw2q5ga4l16l4yvdxkrrfFdb1dvDdJOiA1YzAMAzgYC2byPwdK0uswIBCk5AYO3ONTwMVSqDViefhyaKf+UNQPPEcDNBNcvvKcOB8cjvww3nrb5Wxz32yBJfTNdaNgq2qfEtw9SWhpENx3BUQbU1OfqVow+SMBOP/bAWi/gkzJdc0fKbl5xNqA7/zjNwM/UoWsewBd8KrYzjMtU+AzrSRQM/QKwUu1x0f0FzRir/0S/ithVyNoqYL2x+BHFHR2K3Ddr6TRN42ke6mCu2c=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Emp Full Name" = _t, #"Certification ID" = _t, #"Certification Title" = _t, #"Task 1" = _t, #"Task 1 Instances Submitted" = _t, #"Task 1 Instances Needed" = _t, #"Task 2" = _t, #"Task 2 Instances Submitted" = _t, #"Task 2 Instances Needed" = _t, #"Task 3" = _t, #"Task 3 Instances Submitted" = _t, #"Task 3 Instances Needed" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Emp Full Name", type text}, {"Certification ID", Int64.Type}, {"Certification Title", type text}, {"Task 1", type text}, {"Task 1 Instances Submitted", Int64.Type}, {"Task 1 Instances Needed", Int64.Type}, {"Task 2", type text}, {"Task 2 Instances Submitted", Int64.Type}, {"Task 2 Instances Needed", Int64.Type}, {"Task 3", type text}, {"Task 3 Instances Submitted", Int64.Type}, {"Task 3 Instances Needed", Int64.Type}}),
    Task1 = 
            Table.SelectColumns(#"Changed Type",{"Emp Full Name", "Certification ID", "Certification Title", "Task 1", "Task 1 Instances Submitted", "Task 1 Instances Needed"}),
    Task2 = Table.SelectColumns(#"Changed Type",{"Emp Full Name", "Certification ID", "Certification Title", "Task 2", "Task 2 Instances Submitted", "Task 2 Instances Needed"}),
    Task3 = 
        Table.SelectColumns(#"Changed Type",{"Emp Full Name", "Certification ID", "Certification Title", "Task 3", "Task 3 Instances Submitted", "Task 3 Instances Needed"}),
    #"Append" = 
        Table.Combine({Task1, Task2, Task3})
in
    #"Append"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.