My question is in reference to the following documentation that is part of Power BI Embedded Query Parameters API at https://azure.microsoft.com/en-us/updates/power-bi-embed
Parameters aren't good choice in this case. Using the API you can change their values, but these values are stored in the report itself and all users, who opens these reports, will be affected by the parameter value changes.
You should use filters to achieve that. Let's say you have a table named SchoolData
in your model, and a column named SchoolId
in it. When you embed the report in your application, define a filter for this column, e.g. like this:
const basicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "SchoolData",
column: "SchoolId"
},
operator: "In",
values: [1],
filterType: models.FilterType.BasicFilter
}
And then pass this filter in embed configuration details:
var config = {
type: embedType,
accessToken: accessToken,
tokenType: tokenType,
embedUrl: embedUrl,
id: embedId,
dashboardId: dashboardId,
permissions: permissions,
filters: [basicFilter],
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
};
where 1
is the value corresponding to the currently logged user. Change it every time, when the report is shown in your application, depending on the current user (i.e. 2, 3, 4, etc.).
More information on how to filter data with Power BI Embedded can be found in Filters documentation.