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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ranbeermakin
Resolver III
Resolver III

M Language question: A Column contains a List and a Record both types

Hi all,

 

I'm using pagination to get data from a REST API. The API works fine but results in like this:

Capture.PNG

 

 

As you see the engagement column contains a List and a Record as well. I would like to convert that record to a list. Any clue how to do that? 

After that I can use Table.ExpandListColumn and my code will work fine.

 

Appreciate any help in this.

 

Thanks

Ranbeer

2 ACCEPTED SOLUTIONS
OwenAuger
Super User
Super User

Hi Ranbeer,

 

You can use Value.Is to check if the values in the column are of type record, and if so use Record.ToList to convert the record to a list of field values.

 

Here's some code that worked for me:

= Table.TransformColumns( PreviousStep, { "engagement", each if Value.Is( _, type record ) then Record.ToList( _ ) else _ } )

Another option is:

= Table.TransformColumns( PreviousStep, { "engagement", each try Record.ToList( _ ) otherwise _ } )

Regards

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

Ok, I was able to do this like

 

Table.TransformColumns( previousStep, { "engagement", each if Value.Is( _, type record ) then { _ } else _ } )

View solution in original post

4 REPLIES 4
OwenAuger
Super User
Super User

Hi Ranbeer,

 

You can use Value.Is to check if the values in the column are of type record, and if so use Record.ToList to convert the record to a list of field values.

 

Here's some code that worked for me:

= Table.TransformColumns( PreviousStep, { "engagement", each if Value.Is( _, type record ) then Record.ToList( _ ) else _ } )

Another option is:

= Table.TransformColumns( PreviousStep, { "engagement", each try Record.ToList( _ ) otherwise _ } )

Regards

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thanks Owen.

 

But, what I really wanted was to put that record in a list, and not to convert the record to list of values.

 

Something like

 

Current situation:

[Record]

 

New situation

{List}

Expanding this list should give me the above "[Record]"

[Record]

 

Do you know how to do that?

 

Thanks for help.

Ok, I was able to do this like

 

Table.TransformColumns( previousStep, { "engagement", each if Value.Is( _, type record ) then { _ } else _ } )

Ah gotcha - yes if you just want a record turned into a list containing that record then your solution is perfect 😀

Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors