Converting static queries to dynamic functions
In addition to the standard library of functions available to M queries, user-defined functions can be created to encapsulate the logic of queries for dynamic application against parameter inputs. Like SQL-stored procedures, M functions can be created with or without input parameters, which can be required or optional. Additionally, as functions are values in the M language, just like table and list values, they can be invoked on demand and in multiple areas within a given Power BI data model.
In this recipe, a function is created to support the integration of a list of employee IDs maintained outside the data warehouse environment. The function accepts the employee ID values as parameter inputs and retrieves related column values.
Getting ready
To prepare for this recipe, follow these steps:
- Download
Employees.xlsx
from the following GitHub repository: https://github.com/PacktPublishing/Microsoft-Power-BI-Cookbook...