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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

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
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors