Forum Discussion
Pass Text String as Function Name
- 3 years ago
Hi,
With Fn_US, Fn_CA ... and not Fn-US, Fn_CA
= Table.AddColumn(Source, "ColumnName", each Expression.Evaluate("Fn_"&[Geo]&"()",#shared))With Fn-US
= Table.AddColumn(Source, "ColumnName", each Expression.Evaluate("#(#)""Fn-"&[Geo]&"""()", #shared))Stéphane
slorin thanks! It never occured to me to look for a function that would execute functions! (duh!). Thanks also for the tip on syntax in terms of '_' versus '-'.
After posting it occured to me that I could also embed IF's into a single function, and pass the geo code for evaluation by the IF and that does seem to work.
For my purposes I think multiple functions (by geo) would be cleaner, however I am curious to know if anyone has feedback on the relative performance and/or peformance penalties of using the execute function with concatentation versus a series of embedded IF statements in a single function. It strikes me that the IF route would impose a 'higher' penalty though it is likely pretty minimal.