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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Expanding a column of Lists and Records

  1. I have a column with LISTS and RECORDS
  2. Inside each list there is multiple records
  3. Inside each record there is : FLTINFO, ORIGIN, DESTINATION, etc.
  4. Inside FLTINFO there is FLIGHT (Flight number)
  5. I want to see the flight number listed in a column.
2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can refer to this thread for details:https://community.powerbi.com/t5/Power-Query/Difficulties-with-Expanding-columns-with-list-and-record-values/m-p/757875 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

I should mention my current code which returns an error (when trying to expand records) is:

let
    Source = DocumentDB.Contents("https://acaze2-ai-uat-cdb-ca-fac.documents.azure.com:443/"),
    reporting = Source{[id="reporting"]}[Collections],
    reporting_live_booking = reporting{[db_id="reporting",id="live_booking"]}[Documents],
    #"Expanded Document" = Table.ExpandRecordColumn(reporting_live_booking, "Document", {"data"}, {"Document.data"}),
    #"Expanded Document.data" = Table.ExpandRecordColumn(#"Expanded Document", "Document.data", {"ESWEBSERVICE"}, {"Document.data.ESWEBSERVICE"}),
    #"Expanded Document.data.ESWEBSERVICE" = Table.ExpandRecordColumn(#"Expanded Document.data", "Document.data.ESWEBSERVICE", {"ECIBOK-OUT"}, {"Document.data.ESWEBSERVICE.ECIBOK-OUT"}),
    #"Expanded Document.data.ESWEBSERVICE.ECIBOK-OUT" = Table.ExpandRecordColumn(#"Expanded Document.data.ESWEBSERVICE", "Document.data.ESWEBSERVICE.ECIBOK-OUT", {"BKG-INFO"}, {"Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO"}),
    #"Expanded Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO" = Table.ExpandRecordColumn(#"Expanded Document.data.ESWEBSERVICE.ECIBOK-OUT", "Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO", {"SEGS"}, {"Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO.SEGS"}),
    #"Expanded Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO.SEGS" = Table.ExpandRecordColumn(#"Expanded Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO", "Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO.SEGS", {"SEG"}, {"Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO.SEGS.SEG"}),
    step1 = Table.ExpandRecordColumn(#"Expanded Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO", "Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO.SEGS", {"SEG"}, {"Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO.SEGS.SEG"}),
    step2  = Table.RenameColumns(step1,{{"Document.data.ESWEBSERVICE.ECIBOK-OUT.BKG-INFO.SEGS.SEG", "Flights"}}),
    Flights1 = step2[Flights],
    #"Converted to Table" = Table.FromList(Flights1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    step4 = Table.SelectRows(#"Converted to Table", each [Column1] <> null and [Column1] <> ""),
    fieldForRec  = Table.AddColumn(step4,"Rec",each if Value.Is([FLTINFO], type record) then [ORIGIN] else null,type record)
in
    fieldForRec

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.