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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.