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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
hath117
New Member

Split variables and associated values into separate columns

Hi!
I have this particular table:

VariablesValues
new person4
new person9
new person8
new person2
old person5
old person1
old person7
old person3

 

Now I want to convert the table in such a way that the final output should return this:

VariableValue_1VariableValue_2
new person4old person5
new person9old person1
new person8old person7
new person2old person3

 

So basically I want to split the variables and their associated values from one column to separate columns. Any tips / workarounds ?

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

=Table.FromColumns(List.Combine(Table.Group(PreviousStepName,"Variable",{"n",Table.ToColumns})[n]),List.TransformMany({0..List.Count(List.Distinct(PreviousStepName[Variable]))-1},each Table.ColumnNames(PreviousStepName),(x,y)=>if x=0 then y else y&"_"&Text.From(x)))

View solution in original post

1 REPLY 1
wdx223_Daniel
Super User
Super User

=Table.FromColumns(List.Combine(Table.Group(PreviousStepName,"Variable",{"n",Table.ToColumns})[n]),List.TransformMany({0..List.Count(List.Distinct(PreviousStepName[Variable]))-1},each Table.ColumnNames(PreviousStepName),(x,y)=>if x=0 then y else y&"_"&Text.From(x)))

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors