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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
markew1
Helper I
Helper I

User-Defined Function w/ List Parameter

2018-01-15 10_25_46-.png

 

When I pass a list to a user defined function (shown in Excel above) I get a Choose Column button upon invocation to specify a table column rather than a field to provide a list reference.  Why is this?  Are lists not supported?  Is my parameter declaration incorrect?

 

As an aside, I should mention that I did see a Chris Webb blog entry that describes the behavior that I show above.  He shows how this behavior can be used to good effect; however, I want to pass a "list of lists" as an argment and have the user-defined function process it as is.  Why can't I do that?

1 ACCEPTED SOLUTION

I've added a UserVoice entry requesting changes to the invocation dialog to support stand-alone lists as well as a table column.  

 

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/32987845-user-defined-function-in...

 

I would appreciate your Vote if you agree with this needed change.

 

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@markew1,

In Chris's blog, when clicking "Choose Column", all of the values from that column will be passed as a list in the function.

Could you please share sample data and post the expected result ? And how about you use parameter in Power BI Desktop? There is another Chris's blog about defining parameter in Power BI Desktop for your reference.

In addition, for Power Query issues, you can post questions in Power Query forum to get better support.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Lydia, thanks for the reply.  I didn't find Chris's blog on parameters very helpful in the circumstances that led me to post my concern.  Let's say that I have shared a user-defined function via my Data Catalog, and that function is designed to accept a list of lists ( e.g., {{"A","apple"},{"B","banana"},{"C","cherry"}} ) rather than a table.  Now when a less sophisticated user attempts to add a custom table column by invoking my user-defined function ( using the Add Column Invoke Custom Function ribbon tool ) they are prompted for a table column to be passed as an argument rather than the intended list of lists.  Shouldn't the invocation recognize that such a circumstance could exist, and allow for a drop-down list of all list objects as well as a drop-down list of tables from which a single column could be selected?

I've added a UserVoice entry requesting changes to the invocation dialog to support stand-alone lists as well as a table column.  

 

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/32987845-user-defined-function-in...

 

I would appreciate your Vote if you agree with this needed change.

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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