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
Hougaard77
Regular Visitor

Embedded report showing old rendering

I am using a filter on my Power BI embedded report to select the customer number to show a particular customer his data. The filter is set using JavaScript according to the tutorials online.

 

However, when opening the report, it often shows another customer's data until a new report is loaded. It seems that the old rendering is saved. But obviously I need the report to start out blank and then apply the filter instead of showing the wrong data and revealing one customers report to the other.

 

How can I make that happen?

 

Best regards,

 

Erik

5 REPLIES 5
v-ljerr-msft
Employee
Employee

Hi @Hougaard77,

 

Where did you set the filter, in the onload event, or other event?

 

The Power BI Javascript should support setting filter when embedding without the rendering issue. Following is a similar thread for reference: https://community.powerbi.com/t5/Developer/how-to-create-custom-filters-for-power-bi-embedded-report...

The Power BI Javascript support set filter when embedding. Check this wiki. You can find a more integrated live demo by clicking Custom Filter Pane.

 

A simple demo I use to test for your reference.

 

<html>

 <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>  
 <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js""></script>

<script type="text/javascript">
var embedConfiguration = {
    type: 'report',
    accessToken: 'token',
    embedUrl: 'embedURL' 
}; 

var report;

window.onload = function () { 

var $reportContainer = $('#reportContainer');
 
 report= powerbi.embed($reportContainer.get(0), embedConfiguration);
 
 
 var Filter1 = {
$schema: "http://powerbi.com/product/schema#advanced",
target: {
table: "Table1",
column: "T1id"
},
logicalOperator: "OR",
conditions: [
{
operator: "Contains",
value: "id1"
} 
]
}
 
report.on('loaded', event => {
  report.getFilters()
    .then(filters => {
	
      filters.push(Filter1); 
return report.setFilters(filters); }); }); } function reloadreport(){ var $reportContainer = $('#reportContainer'); powerbi.embedNew($reportContainer.get(0), embedConfiguration); }; </script> <div id="reportContainer"></div> </html>


 

Regards

Hi,

 

First of all, I tried specifying the filter in the embedConfiguration

 

Then I applied it in the loaded event which causes the same behaviour: Data from the previous rendering is shown until a refresh has been completed (takes 5 seconds or so)

 

Finally I tried applying the filter in the onload event but that seems to cause the filter to be completely ignored after switching between pages in the report.

 

So, unfortunately the issus is not solved. I event tried applying a "front page" to my report and setting navContentPaneEnabled to false until the rendered event would set it true. But that event fires as soon as the front pages has been rendered and the other pages still contain data that does not match the filter.

 

Looking forward to you advice,

 

Erik

Hello Erik,

Have you found any solution? i tried to put cache control = No. but still the iframe initially displays old data for fraction of 5 seconds and then filters based on the criteria chosen.

Hi,

 

Sorry about the late reply. I was notified about your question only now - 2 months after you posted it 🙂

 

I did not manage to find a solution. In this particular project we decided to build our reporting around chartJS instead.

 

Best regards,

 

Erik

Any update on this? Is the issue resolved from Microsoft?

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.

Top Solution Authors
Top Kudoed Authors