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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
RICHARDCHIANG1
Frequent Visitor

Excel power query - combine list of records into single table

 

Hi,

I'm a newbie to Excel Power Queries (M language) and would appreciate some help. I have a table with a list of records called 'repTbl'. I wish to extract the contents of each record (2 records in the example below), and combine them into a single table.

 

Is there a way to do this efficiently using a loop or?

 

 let Source = Json.Document(Web.Contents(") aggregateByTradeLite = Source[aggregateByTradeLite], 
repTbl = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"reportResponse"}, {"Column1.reportResponse"}),


# loop 1 tmp = repTbl{0}[Column1.reportResponse], resetNotionalReport = tmp[resetNotionalReport], tmpTbl1 = Table.FromList(resetNotionalReport, Splitter.SplitByNothing(), null, null, ExtraValues.Error), tbl1 = Table.ExpandRecordColumn(tmpTbl1, "Column1", {}), # loop 2 tmp2 = repTbl{1}[Column1.reportResponse], resetNotionalReport2 = tmp2[resetNotionalReport], tmpTbl2 = Table.FromList(resetNotionalReport2, Splitter.SplitByNothing(), null, null, ExtraValues.Error), tbl2 = Table.ExpandRecordColumn(tmpTbl1, "Column1", {}), # combine tables from loops above combinedTable = Table.Combine({tbl1, tbl2}),

 

1 REPLY 1
wdx223_Daniel
Super User
Super User

 let Source = Json.Document(Web.Contents(") aggregateByTradeLite = Source[aggregateByTradeLite], 
repTbl = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"reportResponse"}, {"Column1.reportResponse"}),


Custom1=Table.TransformColumns(repTbl,{"Column1.reportResponse",each let resetNotionalReport=[resetNotionalReport], tmpTbl1 = Table.FromList(resetNotionalReport, Splitter.SplitByNothing(), null, null, ExtraValues.Error), tbl1 = Table.ExpandRecordColumn(tmpTbl1, "Column1", {}) in tbl1})
Custom2=Table.Combine(Custom1[Column1.reportResponse])
in Custom2

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors