Forum Discussion
Expression.Error: We cannot convert the value "[Function]" to type Function
Hi Anonymous
The error "We cannot convert the value '[Function]' to type Function" occurs because Power BI loses the reference to the PriorVisitIEN function after exporting the report as a PBIT template and then importing it as a PBIX file. This happens because Power BI sometimes fails to properly restore function dependencies when reloading the file. To fix this, open Power Query Editor and check if PriorVisitIEN still exists in the Queries pane under the Functions section. If it's present but not recognized, remove the column where it's used and re-add it using Invoke Custom Function. Ensure that PriorVisitIEN is correctly set as a function and not mistakenly treated as a table or disabled. Additionally, if the function depends on other queries or parameters, verify that they are properly restored in the PBIX file. If necessary, manually recreate the function by adding a new blank query, renaming it as PriorVisitIEN, and pasting its M code. Finally, check for missing dependencies or broken references, as Power BI sometimes requires manual re-linking after moving reports between environments. This should resolve the function reference issue and allow the query to work correctly.