Skip to main content

Power BI

New

provide full support for Expression.Evaluate with #shared

Vote (9) Share
Brett Gerhardi's profile image

Brett Gerhardi on 21 Jun 2017 18:44:48

A couple of times now I have had a call to use Expression.Evaluate which currently does not work with the #shared table. It seems that the #shared table does not provide any custom objects during loading into Power BI however it does work in Power Query in preview mode perfectly fine.

e.g. I have a function that takes a table in a defined format as an argument. I wanted to have a configuration table with a column that has the name of a pre-defined table name that applies to this row. I will want to add tables over time and many rows will share the same table. I wanted to simply duplicate the table and set values and add the new table name in the column and it uses Expression.Evaluate([ColName],#shared) to provide the table structure required. This works in preview but not during Load into Power BI as #shared does not contain any of my custom tables. I had to work around this with an intermediate function with a big set of if-then-elses
e.g. (if [colname] = "mytable" then mytable else ....

I'm sure there are many more useful examples of using Power BI with Expression.Evaluate so it would be great if this could be fully implemented.