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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
nazanael1
New Member

Power BI embedding - Set and replace filters at embed time (config object)

Hello,

 

We are trying to embed a Power BI report into our web application. That report has a filter that we want to overwrite at embedding time.

We want to use the OnLoadFilters interface from IReportEmbedConfiguration, because it gives us the possibility to replace the current filter with the new one using the allPages section.

We do not want to use the setFilters after the report is loaded as it has bad performance in our case.

The problem is that it is not working. We want to set filters and replace the current ones in embedding time, using the config.

Is there any way to solve this?

 

Thank you,

 

 

5 REPLIES 5
nazanael1
New Member

no more ideas about how to achieve this?

nazanael1
New Member

Hello,

Although it's a good idea it's not what we really want to do, as it would involve using bookmarks just to have 1 filter. What we want to achieve is to send a filter in embedding time, replacing the default one, without having to wait until the report is loaded. Is this possible somehow?

Hi @nazanael1,

I check the document about embedded config and find it include filters option, I think you can use it to setting the filters:

Configure embedded Power BI report settings in a Power BI embedded analytics application | Microsoft...

Use filters when embedding a report in Power BI embedded analytics | Microsoft Learn

var basicFilter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Table",
    column: "Column"
  },
  operator: "In",
  values: [1, 2, 3, 4]
}

var config = {
  type: 'report',
  accessToken: 'access-token',
  embedUrl: 'https://app.powerbi.com/reportEmbed?reportId=report-id',
  filters: [basicFilter]
};

var reportContainer = $('#reportContainer')[0];
var report = powerbi.embed(reportContainer, config);

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hello,

That is what we want to do. The issue doing it this way is that it does not overwrite the default filter. In the image, the report after being embedded. In the original report, the Filter is set as "Light".

Doing what you explained, I changed to "Dark", but it is not being replaced, just adds it twice (Even having Require single selection).

 

Original (Power BI Service)

 

Screenshot 2023-09-13 at 09.54.20.png

 

Embedded: After adding "Dark" in the config

 

Screenshot 2023-09-13 at 09.48.54.png

We expected here to remove the Light and add the Dark filter.

 

That is why I wanted to use ReportOnLoadFilters, to be able to replace the previous one.

 

Is there any way to replace it using the config object?

v-shex-msft
Community Support
Community Support

Hi @nazanael1 ,

I'd like to suggest you try to use the bookmark feature to saving these filter effect, then you can use this bookmarks to restore the filter to specific status instead of use setfilter interface.

Enhance your users' experience with bookmarks in Power BI embedded analytics | Microsoft Learn

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.