cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

How To assemble data data in Power query

Hi All,

I need help in to assemble data in below manner

Problem

Column1Column6Column7Column8Column9
Sep 2020FunctionQueueQueueQueue
Sep 2020PriorityP1P1P1
Sep 2020TeamMemberInsurancePension
Sep 2020Team Target Coverage10.90.9
 Oct 2020FunctionQueue  
 Oct 2020PriorityP1P1P1
 Oct 2020TeamMemberInsurancePension
 Oct 2020Team Target Coverage10.90.9
 Nov 2020FunctionQueue  
 Nov 2020PriorityP1P1P1
 Nov 2020TeamQeue-MemberInsurancePension
 Nov 2020Team Target Coverage10.90.9

 

Solution

 

MonthFunctionPriorityTeamTeam Target Coverage
Sep-20QueueP1Member1
Sep-20QueueP1Insurance0.9
Sep-20QueueP1Pension0.9
Oct-20QueueP1Member1
Oct-20 P1Insurance0.9
Oct-20 P1Pension0.9
Nov-20QueueP1Qeue-Member1
Nov-20 P1Insurance0.9
Nov-20 P1Pension0.9
1 ACCEPTED SOLUTION
Super User III
Super User III

Hello @Jazz-123 

 

you can use a Table.Group where you apply a Table.Transpose, Table.Ski and a Table.PromoteHeaders.

Here the code

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jY6xCsIwEIZfJWSuErs5C4KD2mK30iGGo2RoItek0Lc3Jx1ilDZD7v7h+y9f2/IHvFgpSsELfvZGOW1NiLUHDz+7K774CrVF7WaKh2gkWANyCOsKwxMwhIsZPUqj6G4FZqQf/1RYI7EHx052ApQ90XRf7I/LpA67K7eizz4vBde8Yy5XPO3kmd/slGcegavmEbeY1+HWbls/KW7rd28=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column6 = _t, Column7 = _t, Column8 = _t, Column9 = _t]),
    #"Grouped Rows" = Table.Group(Source, {"Column1"}, {{"AllRows", each Table.PromoteHeaders(Table.Skip(Table.Transpose(_), 1))}}),
    #"Expanded AllRows" = Table.ExpandTableColumn(#"Grouped Rows", "AllRows", {"Function", "Priority", "Team", "Team Target Coverage"}, {"Function", "Priority", "Team", "Team Target Coverage"})
in
    #"Expanded AllRows"

Jimmy801_0-1606909780967.png

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

1 REPLY 1
Super User III
Super User III

Hello @Jazz-123 

 

you can use a Table.Group where you apply a Table.Transpose, Table.Ski and a Table.PromoteHeaders.

Here the code

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jY6xCsIwEIZfJWSuErs5C4KD2mK30iGGo2RoItek0Lc3Jx1ilDZD7v7h+y9f2/IHvFgpSsELfvZGOW1NiLUHDz+7K774CrVF7WaKh2gkWANyCOsKwxMwhIsZPUqj6G4FZqQf/1RYI7EHx052ApQ90XRf7I/LpA67K7eizz4vBde8Yy5XPO3kmd/slGcegavmEbeY1+HWbls/KW7rd28=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column6 = _t, Column7 = _t, Column8 = _t, Column9 = _t]),
    #"Grouped Rows" = Table.Group(Source, {"Column1"}, {{"AllRows", each Table.PromoteHeaders(Table.Skip(Table.Transpose(_), 1))}}),
    #"Expanded AllRows" = Table.ExpandTableColumn(#"Grouped Rows", "AllRows", {"Function", "Priority", "Team", "Team Target Coverage"}, {"Function", "Priority", "Team", "Team Target Coverage"})
in
    #"Expanded AllRows"

Jimmy801_0-1606909780967.png

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

Helpful resources

Announcements
secondImage

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

secondImage

Power BI Women

Join our monthly meetings and learning sessions.

secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors