Search code examples
powerbipowerbi-embeddedpowerbi-datasource

How can I use a parameter in a MS Power Bi web data source string?


I have a URL that returns a json object with everything I need for my power bi embedded report. I get the data for the report by adding a new web data source and pasting the URL in. a few transformations later and tada! sexy report. the report shows lots of charts and graphs etc... however I need to be able to change the datasource URL depending on who is looking at it.

The report shows data for a single organization. You can only look at it if you're in that organization. how can I pass an organizations ID when embedding the report so that the datasource will show different data?

for example if my datasource is defined in the originating pbix as

Json.Document(Web.Contents("http://www.testdata.com/api/json?orgId=1"))

how can I change it to

Json.Document(Web.Contents("http://www.testdata.com/api/json?orgId=2"))

when I'm pull the report to embed on a page?

I know you can filter data but that means I have to make the datasource URL pull ALL the data which would be huge and intensive just to have bi filter out something.

In short, I'm embedding a report on a website and tat report's only way to get data is via a json endpoint. That endpoint requires the org id of the user so how do I pass it to bi which in turn uses it in the data source url?


Solution

  • Your only option for this scenario is to pull all the required data into your dataset. Then you can use either Role Level Security (RLS) or the new JS API to filter the data for each user.

    You should probably look at an Azure SQL data source as a more efficient, flexible and scalable back-end for PBI Embedded.