cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
FredLEGUEN Frequent Visitor
Frequent Visitor

Create dynamic list in Power Query

Hi,

 

Create a list in Power Query it's easy {[col1], [col2], [col3])

But how do you create a list when you have a variable number of columns ?

In my case, my headers' name are simple, it's [1], [2], [3], ..... But I don't know if I will have 5 columns or 50.

 

In that case, how to you convert the values of these columns into a List ?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Create dynamic list in Power Query

@FredLEGUEN,

 

You may change it as follows.

Record.ToList(Record.RemoveFields(_, {"Column1", "Column2"}))
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Community Support Team
Community Support Team

Re: Create dynamic list in Power Query

@FredLEGUEN,

 

You may simply add a custom column.

Record.ToList(_)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
FredLEGUEN Frequent Visitor
Frequent Visitor

Re: Create dynamic list in Power Query

Ok Thanks Sam,

 

But if want all the columns except the first column or, like in my case, exclude the first 4 columns from your List. In that case, what do you do ?

Community Support Team
Community Support Team

Re: Create dynamic list in Power Query

@FredLEGUEN,

 

You may change it as follows.

Record.ToList(Record.RemoveFields(_, {"Column1", "Column2"}))
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.