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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
FCD
Regular Visitor

Add Variable quantity of columns and transpose data

Dear All,

I have a table called table1 with 2 differents columns (called Letter and Type)

I wish I can create a new table (table2) from this table containing in the first colum all the distinct Types and next as many columns as the maximum qty of different Letters in each type (n).

Each column will be called like KW1, KW2, …, KWn

Then the values of Types will be added in the different columns. If there is no value, the cell will remain empty.

 

See attached screenshot to show what I expect to get.

Thank you for help.

Best RegardsExpectedResult.GIF

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi @FCD 

 

= Table.Combine(
Table.Group(Your_Source,
{"Type"},
{{"Data", each Table.FromRows(
{{[Type]{0}} & [Letter]},
{"Type"} & List.Transform({1..Table.RowCount(_)}, each "KW" & Text.From(_)))
}})
[Data])

 Stéphane

View solution in original post

2 REPLIES 2
FCD
Regular Visitor

Thank you very much. Just what I expected

slorin
Super User
Super User

Hi @FCD 

 

= Table.Combine(
Table.Group(Your_Source,
{"Type"},
{{"Data", each Table.FromRows(
{{[Type]{0}} & [Letter]},
{"Type"} & List.Transform({1..Table.RowCount(_)}, each "KW" & Text.From(_)))
}})
[Data])

 Stéphane

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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 Kudoed Authors