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
cu-admin
Regular Visitor

How to transpose a table visual

Hello Forks,

 

I have data like this on my power query 

PersonID Language
184Tukrish
184English
1255Arabic
1255English
1255Turkish

 

and I want to show this data like this 

PersonID Language1 Language2 Language3
184TukrishEnglish 
1255ArabicEnglishTurkish

 

If Anyone have any idea please help 

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @cu-admin, different approach here.

 

Result

dufoq3_0-1711007836540.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrQwUdJRCinNLsoszlCK1YGJuOal58BFjExNgUKORYlJmcnIIlgUhZQWZYOFYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [PersonID = _t, Language = _t]),
    GroupedRows = Table.Group(Source, {"PersonID"}, {{"Count", Table.RowCount}, {"All", each
        [ a = Table.Transpose(Table.SelectColumns(_, {"Language"})),
          b = List.Transform({ 1..Table.ColumnCount(a) }, (x)=> "Language" & Text.From(x)),
          c = List.Zip({ Table.ColumnNames(a), b }),
          d = Table.RenameColumns(a, c)
        ][d], type table}}),
    ExpandedAll = Table.RemoveColumns(Table.ExpandTableColumn(GroupedRows, "All", List.Transform({ 1..List.Max(GroupedRows[Count]) }, each "Language" & Text.From(_))), {"Count"})
in
    ExpandedAll

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

3 REPLIES 3
slorin
Super User
Super User

Hi, one more solution

 

let
Source = Your_Source,
GroupedRows = Table.Group(Source, {"PersonID"},
{{"All", each #table(
{"PersonID"} & List.Transform({ 1..Table.RowCount(_)}, each "Language" & Text.From(_)),
{{[PersonID]{0}} & [Language]} )
}}),
Combine = Table.Combine(GroupedRows[All])
in
Combine

 Stéphane

dufoq3
Super User
Super User

Hi @cu-admin, different approach here.

 

Result

dufoq3_0-1711007836540.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrQwUdJRCinNLsoszlCK1YGJuOal58BFjExNgUKORYlJmcnIIlgUhZQWZYOFYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [PersonID = _t, Language = _t]),
    GroupedRows = Table.Group(Source, {"PersonID"}, {{"Count", Table.RowCount}, {"All", each
        [ a = Table.Transpose(Table.SelectColumns(_, {"Language"})),
          b = List.Transform({ 1..Table.ColumnCount(a) }, (x)=> "Language" & Text.From(x)),
          c = List.Zip({ Table.ColumnNames(a), b }),
          d = Table.RenameColumns(a, c)
        ][d], type table}}),
    ExpandedAll = Table.RemoveColumns(Table.ExpandTableColumn(GroupedRows, "All", List.Transform({ 1..List.Max(GroupedRows[Count]) }, each "Language" & Text.From(_))), {"Count"})
in
    ExpandedAll

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use this code. Replace your source appropriately

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"PersonID"}, {{"All", each Record.Combine({[PersonID = Table.FirstValue(_)]} & List.Transform({1..Table.RowCount(_)}, (i)=> Record.AddField([], "Language" & Text.From(i), _[Language]{i-1})))}})[[All]],
    #"Expanded All" = Table.ExpandRecordColumn(#"Grouped Rows", "All", Record.FieldNames(Record.Combine(#"Grouped Rows"[All])))
in
    #"Expanded All"

 

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.

Top Solution Authors