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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
rpiboy_1
Helper V
Helper V

Passing an argument through Expression.Evaluate

Building from this thread: Solved: Pass Text String as Function Name - Microsoft Fabric Community

 

And having also reviewed Chris Webb's blog post as noted in the same thread.

 

I need to pass an arguement to the function, from a colum. So my set-up looks like this:

 

GeoDataType
USprojects
USusers
CAprojects
CAusers

 

so now I need to write an expression that looks like this:

 

 

    #"ExecuteFunction" = Table.AddColumn( 
        Source,
        "AdminData",
        each Expression.Evaluate(
            "FnAdminQuery"&[Geo]&"("&[DataType]&")",
            #shared
        )

 

 

The trouble of course is the inner referecnce to the 'DataType' column. I was able to create a combined Record that included the List of [DataType] with #shared (per CW's blog post) but of course I get an error because I'm attempting to pass a List to the Function Arguement that is looking for a Text String. I'm not sure how to pass the current row state to the inner function to get the correct index from the List, or perhaps a different approach?

 

CW's blog post only deals with static variables that are constant for the entire expression. If Reza Rad's blog post (referenced by CW) has more information, the current link returns a 500 error.

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi, 

 

use Function.Invoke

 

Function.Invoke(Expression.Evaluate("FnAdminQuery"&[Geo], #shared),{[DataType]})

 Stéphane

View solution in original post

3 REPLIES 3
slorin
Super User
Super User

Hi, 

 

use Function.Invoke

 

Function.Invoke(Expression.Evaluate("FnAdminQuery"&[Geo], #shared),{[DataType]})

 Stéphane

Thanks so much! That was much easier than I was expecting!

rpiboy_1
Helper V
Helper V

@slorin perhaps you can shed some further light on my challenge. TY!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors