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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mikeborg82
Helper II
Helper II

Table transformation (pivot unpivot????)

Table transformation...  the top three rows are how the data appears, I want the data to look like it does below in one row... i assume this is possible, any ideas and help?  Thank you so much.

RankNameRatingNumber of ratings  
1Kentucky Brunch Brand Stout4.84615  
1Toppling Goliath Brewing Company4.84615  
1American Double / Imperial Stout / 12.00% ABV4.84615  
      
      
RankNameName 2Name 3RatingNumber of ratings
1Kentucky Brunch Brand StoutToppling Goliath Brewing CompanyAmerican Double / Imperial Stout / 12.00% ABV4.84615
1 ACCEPTED SOLUTION

Indeed, a little bit from both because this includes some logic I recntly learned from @ImkeF

 

let
    Source = Table1,
    Grouped = Table.Group(Source, {"Rank", "Rating", "Number of ratings"}, {{"Names", each Table.FromRows({[Name]}), type table}}),
    Reordered = Table.ReorderColumns(Grouped,{"Rank", "Names", "Rating", "Number of ratings"}),
    ExpandedNames = Table.ExpandTableColumn(Reordered, "Names", Table.ColumnNames(Table.Combine(Reordered[Names]))),
    RenamedColumns = Table.TransformColumnNames(ExpandedNames, each Replacer.ReplaceText(_, "Column", "Name "))
in
    RenamedColumns
Specializing in Power Query Formula Language (M)

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

That's a question for @MarcelBeug or @ImkeF.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Indeed, a little bit from both because this includes some logic I recntly learned from @ImkeF

 

let
    Source = Table1,
    Grouped = Table.Group(Source, {"Rank", "Rating", "Number of ratings"}, {{"Names", each Table.FromRows({[Name]}), type table}}),
    Reordered = Table.ReorderColumns(Grouped,{"Rank", "Names", "Rating", "Number of ratings"}),
    ExpandedNames = Table.ExpandTableColumn(Reordered, "Names", Table.ColumnNames(Table.Combine(Reordered[Names]))),
    RenamedColumns = Table.TransformColumnNames(ExpandedNames, each Replacer.ReplaceText(_, "Column", "Name "))
in
    RenamedColumns
Specializing in Power Query Formula Language (M)

wow, that is awesome!!  It worked brilliantly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.