Passing parameters to Power BI filter programmatically

+1 vote
In my application I'm displaying a Power BI report. It already works, so there's no problems with showing any report by its ID (guid).

But there are some reports that need to be parametrized, for instance, with current year or person who views the report.

That's my question: how to do it?
Sep 19, 2018 in Power BI by Nilesh
• 7,060 points
8,350 views

2 answers to this question.

0 votes

One of the way to get the paremeters externally is by using power bi application:

You can specify the filter by setting filter parameter in the report URL (in browser address bar). Parameter takes custom filter query:

https://app.powerbi.com/groups/me/reports/12345678-6418-4b47-ac7c-f8ac7791a0a7?filter=Store/PostalCode eq '15012'

where "12345678-6418-4b47-ac7c-f8ac7791a0a7" is a report id, and "Store" is a dataset, and PostalCode is a parameter to be filter out. "eq" is a equality operator.

URL should be encoded, so final url looks like this:

https://app.powerbi.com/groups/me/reports/12345678-6418-4b47-ac7c-f8ac7791a0a7?filter=Store/PostalCode%20eq%20%2715012%27

Related Queries

How can I create dynamic parameters in Power BI using DAX?

What debugging tools or methods do you use to pinpoint and resolve DAX or Power Query coding errors?

answered Sep 19, 2018 by Kalgi
• 52,350 points
0 votes

In addition to @Kalgi's answer, there's another way to do this:

JavaScript (browser client side) controls the loaded BI report by postMessage() calls with parameters (just like in the question above). There is an extra option oDataFilter that can be set to filter the report.

Set it like this: oDataFilter: "Store/PostalCode eq '15012'"

Full code would look like this:

function onFrameLoaded() {
    var m = {
        action: "loadReport",
        reportId: reportId,
        accessToken: accessToken,
        oDataFilter: "Store/PostalCode eq '15012'"
    };

    iframe.contentWindow.postMessage(JSON.stringify(m), "*");
}

If you are interested in learning Power BI, check out Power BI Curriculum now!

Also Read:

How to manage file size and multiple numeric what-if parameters?

answered Sep 19, 2018 by Nilesh
• 7,060 points

Related Questions In Power BI

0 votes
1 answer

Passing a parameter to Power BI Embedded via embedded URL

Add the following to the end of ...READ MORE

answered Oct 23, 2018 in Power BI by Annie97
• 2,160 points
4,957 views
0 votes
1 answer

How to create a new slicer to filter data by district manager in Power BI?

Follow the steps Open power bi  desktop nd ...READ MORE

answered Oct 10, 2023 in Power BI by Monika kale
959 views
0 votes
1 answer
0 votes
1 answer

Power BI DAX - adding date filter to DAX Query

VALUES('Combination'[Requirement]) gives you a table with all the ...READ MORE

answered Feb 23, 2022 in Power BI by CoolCoder
• 4,420 points
1,876 views
0 votes
1 answer

Displaying Table Schema using Power BI with Azure IoT Hub

Answering your first question, Event Hubs are ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,342 views
+1 vote
1 answer

Unable to install connector for Power Bi and PostgreSQL

I think the problem is not at ...READ MORE

answered Aug 22, 2018 in Power BI by nirvana
• 3,130 points
2,738 views
+1 vote
1 answer

Connect power bi desktop to dataset and create custom reports

Yes using Power BI REST API to ...READ MORE

answered Sep 18, 2018 in Power BI by Kalgi
• 52,350 points
1,658 views
0 votes
1 answer

Programmatically sign in - power bi

Basically: POST request to: https://login.microsoftonline.com/common/oauth2/token Body, form-url-encoded: grant_type: "password" scope: "openid" resource: "https://analysis.windows.net/powerbi/api" client_id: ...READ MORE

answered Sep 19, 2018 in Power BI by Kalgi
• 52,350 points
1,321 views
0 votes
1 answer

Filter parameters in Power BI

I think this happening because you're using ...READ MORE

answered Oct 3, 2018 in Power BI by Kalgi
• 52,350 points
920 views
+2 votes
2 answers

Migrate power bi collection to power bi embedded

I agree with Kalgi, this method is ...READ MORE

answered Oct 11, 2018 in Power BI by Hannah
• 18,520 points
1,511 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP