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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
Community Champion
Community Champion

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

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.