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

Custom Column - Pass current row as a record to a function

I'm trying to create a query that has a step that processes a column that contains a table th adds a custom column that uses a custom function to transform the contents of the table calue of the column.

I'm using the custom function since the transformation code is quite complex.

My issue is how to 2 part:

  1. How to a structure the call from "each" to pass the current row as a record parameter to my custom function
  2. Specifiy the correct parameter signature in my custom function to receive the record version of thje row passed by the call from "each"

Ideas much appreciated

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your descripition, you want to create a custonm function in Power Query Editor.

And you want to pass   a "record" type parameter in your custom function, and you want to use your table row as this parameter when we call the custom function.

Here are the steps you can refer to :
(1)We can create a customn column with the "record" type parameter like this:

= (re as record) as table=>let rec=Table.FromRecords({re}) in rec

 

(2)We can call this api in another table each row.

We can click "Custom Column" in "Add Column" pane and enter this:

vyueyunzhmsft_0-1692152667632.png

And we can modify the M code like this then we can put this row record to our custom function.

= Table.AddColumn(#"Changed Type", "Custom", each Query1(_)     )

We can also use this M code , this is the same :

= Table.AddColumn(#"Changed Type", "Custom", (x)=> Query1(x)     )

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

 

 

 

View solution in original post

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your descripition, you want to create a custonm function in Power Query Editor.

And you want to pass   a "record" type parameter in your custom function, and you want to use your table row as this parameter when we call the custom function.

Here are the steps you can refer to :
(1)We can create a customn column with the "record" type parameter like this:

= (re as record) as table=>let rec=Table.FromRecords({re}) in rec

 

(2)We can call this api in another table each row.

We can click "Custom Column" in "Add Column" pane and enter this:

vyueyunzhmsft_0-1692152667632.png

And we can modify the M code like this then we can put this row record to our custom function.

= Table.AddColumn(#"Changed Type", "Custom", each Query1(_)     )

We can also use this M code , this is the same :

= Table.AddColumn(#"Changed Type", "Custom", (x)=> Query1(x)     )

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

 

 

 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.