Abhigyan pandey
Abhigyan pandey

Reputation: 41

How to pass parameter to PowerBI Embedded Report

I have a IFrame which shows a PowerBI embedded Report having Accounts Data and I am taking two inputs from user as Start Date and End Date through UI and according to those inputs my Database table is being populated with a unique ID for that selection. Can I pass a parameter to PowerBI Embedded via embedded URL to filter my report based on that input and unique ID for current selection in UI.

Thanks

Upvotes: 3

Views: 9856

Answers (1)

Andrey Nikolov
Andrey Nikolov

Reputation: 13460

No, you can't filter the data using embeddedUrl. You should use filters to achieve that. Let's say you have a table named AccountsData in your model, and a column named DatesId 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: "AccountsData",
        column: "DatesId"
    },
    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 unique ID for that selection. Change it every time, when the report is shown in your application (i.e. 2, 3, 4, etc.).

More information on how to filter data with Power BI Embedded can be found in Filters documentation.

Upvotes: 5

Related Questions