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

Dynamic column expand

Hi all,

 

I want to expand records column dinamically. Here is the code:

 

 

toExpand = Table.ExpandRecordColumn(#"Table to expand", "newColumn name", ListOfNamesToExpand) // ListOfRecords contains a list with text values of each column to expand

 

 

If I do this from UI it takes 2 seconds to expand all rows, but I want to expand it dinamically because data can change upon refresh. When I use the code it takes around 6h for 250 results. Is there a faster way to do this or I'm doing something wrong?

 

Thanks in advance,

 

Mario 

1 ACCEPTED SOLUTION
mariopavic
Frequent Visitor

I didn't compare old vs new code but new one is way faster:

convertToList= Record.FieldNames(Record.Combine(List.Select(Table.Column(#"Removed Other Columns","newColumnName"), each _ <> "" and _ <> null))), 
ListOfNamesToExpand = Table.ExpandRecordColumn( #"Removed Other Columns","newColumnName", convertToList),

The problem was in creating the actual list. 

View solution in original post

1 REPLY 1
mariopavic
Frequent Visitor

I didn't compare old vs new code but new one is way faster:

convertToList= Record.FieldNames(Record.Combine(List.Select(Table.Column(#"Removed Other Columns","newColumnName"), each _ <> "" and _ <> null))), 
ListOfNamesToExpand = Table.ExpandRecordColumn( #"Removed Other Columns","newColumnName", convertToList),

The problem was in creating the actual list. 

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors