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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
mikihiir
Helper III
Helper III

Power bi javascript api data refresh

How do u refresh data in power bi javascript api when using direct query ?

There used to be a refresh function, now it is removed.

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@mikihiir

So far the refresh is not avaible for a production PowerBI Javascript release, you can check Missing a “Refresh” method to efficiently refresh a report/tile. You shall wait for the release.

 

You can try to re-embed the report to do the refresh, this would refresh the data from directquery based on my test.

 

<html>

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

<script type="text/javascript">
var embedConfiguration = {
    type: 'report',
    accessToken: 'yourTokenHere',
    id: '4c42a9f6-3ef4-xxxxxxxxxd5d6ebdac79d',
    embedUrl: 'https://app.powerbi.com/reportEmbed?reportId=4c42a9fxxxxxxxxx-91f5-d5d6ebdac79d' 
}; 

var report;

window.onload = function () { 

var $reportContainer = $('#reportContainer'); 
report= powerbi.embed($reportContainer.get(0), embedConfiguration);
 
} 

function reloadreport(){ 
var $reportContainer = $('#reportContainer');
powerbi.embedNew($reportContainer.get(0), embedConfiguration);

};
</script>
<button onclick="reloadreport()">Click me to refresh</button> <div id="reportContainer"></div> </html>

 

 

View solution in original post

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee

@mikihiir

So far the refresh is not avaible for a production PowerBI Javascript release, you can check Missing a “Refresh” method to efficiently refresh a report/tile. You shall wait for the release.

 

You can try to re-embed the report to do the refresh, this would refresh the data from directquery based on my test.

 

<html>

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

<script type="text/javascript">
var embedConfiguration = {
    type: 'report',
    accessToken: 'yourTokenHere',
    id: '4c42a9f6-3ef4-xxxxxxxxxd5d6ebdac79d',
    embedUrl: 'https://app.powerbi.com/reportEmbed?reportId=4c42a9fxxxxxxxxx-91f5-d5d6ebdac79d' 
}; 

var report;

window.onload = function () { 

var $reportContainer = $('#reportContainer'); 
report= powerbi.embed($reportContainer.get(0), embedConfiguration);
 
} 

function reloadreport(){ 
var $reportContainer = $('#reportContainer');
powerbi.embedNew($reportContainer.get(0), embedConfiguration);

};
</script>
<button onclick="reloadreport()">Click me to refresh</button> <div id="reportContainer"></div> </html>

 

 

thanks

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 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.