Forum Discussion

Parth_1's avatar
Parth_1
Helper I
2 years ago
Solved

How to expand record column dynamically with Power Query

I am expanding the specifications column. The available data is expanding successfully. But when the records are aaded in future in specification column it does not expand it all. 
What query will help in expanding the records dynamically. Below are the images of record column and the query of expanding.

Thanks in advance.

  • = Table.ExpandRecordColumn(#"Reordered Columns", "specifications",Record.FieldNames(Record.Combine(product_data[specifications])))

7 Replies

  • Parth_1 if all records have the same set of fields then read field names into some variable using Record.FieldNames(your_table[specifications]{0}) and use it in expand step. 

    • Parth_1's avatar
      Parth_1
      Helper I

      = Table.ExpandRecordColumn(#"Reordered Columns", "specifications",Record.FieldNames(product_data[specifications]{0}))

      As per your suggestion I Expanded the column with above code but it does not expanding all the records in specification column itself.

      • wdx223_Daniel's avatar
        wdx223_Daniel
        Community Champion

        = Table.ExpandRecordColumn(#"Reordered Columns", "specifications",Record.FieldNames(Record.Combine(product_data[specifications])))

  • adudani's avatar
    adudani
    Memorable Member

    hi Parth_1 
    Intermediate steps containing the dynamic list of all column names would be required.

    in the step shown in the screenshot, you would input the step name instead of the hard-coded values.

     

    Kindly provide a sample input masking sensitive data incase further troubleshooting is required.

     

    Refer to example 1 in this video for a similar concept: The Magic of working with Lists in Power Query (youtube.com)