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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
leganderson
New Member

Transforming rows into columns

Hi Community,

 

I have a table with rows where every name is part of a group.

My objective is to produce a visual with each of the groups as column headers and each name as rows.

I couldnt get this done with pivot/unpivot, but that might be a limitation on my side.

 

Any thoughts would be much appreciated.

 

Annotation 2019-07-30 145711.png

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

@leganderson 

 

Try this.

Please see attached file for steps

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kvMTVUwVNJRci/KLy0AsmJ1oIJG2ASNsQmaYBM0hQsaIQTNsAmawwWNEYIW2AQtkQVjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Group = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Group", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Group"}, {{"ALL", each Table.AddIndexColumn(_,"Index",1,1)}}),
    #"Expanded ALL" = Table.ExpandTableColumn(#"Grouped Rows", "ALL", {"Name", "Index"}, {"Name", "Index"}),
    #"Pivoted Column" = Table.Pivot(#"Expanded ALL", List.Distinct(#"Expanded ALL"[Group]), "Group", "Name"),
    #"Removed Columns" = Table.RemoveColumns(#"Pivoted Column",{"Index"})
in
    #"Removed Columns"

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.