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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
inguvavamsi_1
New Member

You attempted to get an instance of powerbi component associated with element - Portals - Power BI

Hi All,

 

I am getting the below error when i try to use Power BI JS to hide some pages and filters of power bi report in power app portals.

The report is displaying perfectly but the javascript is not working and giving error in console.

Uncaught Error: You attempted to get an instance of powerbi component associated with element

title="Power BI report"></iframe> but there was no associated instance.

 

inguvavamsi_1_0-1638324029276.png

 

 

Below is my code 

{% assign forums_sm = sitemarkers["Forums"] %}

<html>

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

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

 

{% powerbi authentication_type:"AAD" path:"MyPowerBIURL" %}

 


</html>

 

<script>

$(window).load(function() {
// get div container for powerbi report
var embedContainer = $(".powerbi")[0];

// get reference to the embedded report
var report = powerbi.get(embedContainer);

// register a function to execute when report will finish loading
report.on("loaded", function(){
// update existing setting of the reports
// you can disable only one page or both at the same time
report.updateSettings({
panes: {
filters :{
visible: false
},
pageNavigation:{
visible: false
}
}
}).catch(function (errors) {
console.log(errors);
});
})
});
</script>

 

 

Please help how i can get ride of this error.

 

I exactly followed same steps mentioned in msdn link. Please see link here

 

https://docs.microsoft.com/en-us/powerapps/maker/portals/admin/add-powerbi-report

 

Thank you

2 REPLIES 2
inguvavamsi_1
New Member

Hi Jay, 

 

The initial issue got resolved. There are two reasons for the issue 

 

The Liquid Tag 

{% powerbi authentication_type:"AAD" path:"MyPowerBIURL" %} 

Should be 

{% powerbi authentication_type:"powerbiembedded " path:"MyPowerBIURL" %} 

 
This should be powerbiembedded otherwise the javascript will not able to findout the powerbi iframe 
 
The second issue is the power app portals is not loading the latest powerbi js that comes with portal. Hence, i am referring the script again to get latest libraries using below codeset 
 
var script = document.createElement('script');
script.src=file;
script.type = 'text/javascript';
script.defer = true;
 
document.getElementsByTagName('head').item(0).appendChild(script);
 
}
 
 
However, the position: models.PageNavigationPosition.Left still not working and the pages are placed below the report not on the leftside

 

 

Anonymous
Not applicable

Hi @inguvavamsi_1 ,

 

Could it be the version of powerbi.js did not up to date?

 

Best Regards,

Jay

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.