Power BI Embedded Query Parameters API
Updated: March 15, 2018
Query parameters enable users to define parameters and make parts of their reports and data models (such as a query filter, a data source reference, or a measure definition) dependent on one or more parameter values. Parameters are defined on the PBIX file through Power BI Desktop. You can learn more about query parameters in this blog post.
The new Query Parameters API enables developers to dynamically change the values of parameters and automate the process of working with them. The API includes a call to get all parameters defined on a specific dataset, and a call to set new values for existing parameters.
With this new API, you can automate many processes for multiple customers. A few examples are:
- Change connection string. By configuring parameters on the connection string, you can use the API whenever you onboard a new customer. Just clone the report and change the parameter values to connect to the customer’s database. It can also help automate connection updates to data sources that are not supported through the Update Datasources API.
- Change query parameters. By defining parameters on the API, you can set the values and get different results and data to reflect only what this report’s users should see.
- Measure parameters. Dynamically change different calculated measures to answer each customer’s needs on the same report. For example, you can set the currency through parameters for different customers or branches that are based in different countries.
Note that the parameters are based on the dataset, so they are defined per report/dashboard, but not on the user’s session level. It means that different users who are using the same report at the same time will always see the same parameter’s value.