Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mudassarhassan
Frequent Visitor

Custom Url parameters in Power BI

Hi,

 

I want to pass custom parameters passed to power bi service e.g country=us,state=tx,product=notebooks. 

 

https://app.powerbi.com/groups/me/reports/xxx/ReportSection?country=us,state=tx

 

I want data on the report to be displayed using these filters passed in parameters. SInce out of the box functionality is not similar to what I am looking for so I may adopt a solution where I can convert this string to something similar to Power BI format like 

Product/Country eq 'US, Product/State eq 'TX'

 

Regards

Mudassar Hassan

 

1 ACCEPTED SOLUTION

Hi mudassarhassan,

 

You can use URL filter, please refer to: https://docs.microsoft.com/en-us/power-bi/service-url-filters.

 

Regards,

Jimmy Tao

View solution in original post

7 REPLIES 7
macmy034
Advocate II
Advocate II

To pass a parameter to a URL create it elsewhere and pass the following into the URL String:

"""&PARAMETER_NAME&"""

 

3 quotes, an ampersand and keep the parameter name to one word otherwise you have to deal with a space too!

Anonymous
Not applicable

@mudassarhassan  Hi there ! hey were you able to achieve your scenario? please share suggestions or on how to. am also facing the same scenario.

 

Thanks!

v-yuta-msft
Community Support
Community Support

Hi mudassarhassan ,

 

Are you trying to replace the part of string to query the data of power bi report in your three-party app? If you are, you can use regular expression to achieve this, suppose you are using javascript, you can write a string replacement operation like below:

var str = "Product/Country eq 'US, Product/State eq 'TX'";
var res = str.replace(/([^a-zA-Z])/g, "").replace(/[product]/g, "").replace(/[eq]/g, "=");

Regards,

Jimmy Tao

Actually I will be calling Power BI Report from web-api which can pass parameters as country=us,state=tx rather than what Power BI Understands. If we have such parameters how can i apply filters to the report data??

Hi mudassarhassan,

 

You can simply create some filters or slicers in your report. Then, suppose you are embedding your report into your website, just modify the embed configuration like below(set filterPaneEnabled as true):

var config= {
    type: 'report',
    tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
    accessToken: txtAccessToken,
    embedUrl: txtEmbedUrl,
    id: txtEmbedReportId,
    permissions: permissions,
    settings: {
        filterPaneEnabled: true,
        navContentPaneEnabled: true
    }
}; 

Regards,

Jimmy Tao

 

 

 

No Jimmy, that didn't work or fulfill my requirement

 

I want to filter the data in dashboard with country=usa, when someone tries to access the PowerBI Dashboard

 

https://app.powerbi.com/groups/me/reports/xxx/ReportSection?country=usa

 

 

Hi mudassarhassan,

 

You can use URL filter, please refer to: https://docs.microsoft.com/en-us/power-bi/service-url-filters.

 

Regards,

Jimmy Tao

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.