I’m not sure if this is possible. I’m quite new to Power BI, have done a lot of research on the forums and on Stack Overflow, but am still not sure if what I want is possible.
We have a current report that is loaded into an iframe on a public web page using a connection to Sql Server tables as the data source. We need to change this so that a filter is applied to the data based on the user who is logged in to our web app. This means the report would differ for each user. (Ths user is our app user, not the Sql user)
What I want to do is change the datasource so that it calls an API in our app, which then returns Json data. Our API would need to be passed the UserId as a parameter so it can filter the results by user before returning data.
To make this work, I would first need to pass the UserId into Power BI via the javascript we’re currently using to load the report. The javascript looks like this:
config = { type: 'report', tokenType: models.TokenType.Embed, accessToken: '@Model.EmbedToken.Token', embedUrl: '@Html.Raw(Model.EmbedUrl)', id: '@Model.Id', permissions: models.Permissions.All, settings: { filterPaneEnabled: false, navContentPaneEnabled: true, viewMode: 'view' } }; report = powerbi.embed(reportContainer, config);
Is this possible? Is there a way to pass an extra custom parameter into Power BI via javascript and then for Power BI to pass that paramater back to our API as part of datasource URL?