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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
FredLEGUEN
Helper III
Helper III

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

@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.

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@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.

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 ?

@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.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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