How can we help you today?

How to Auto Refresh the Reports on the Page Having ShortPoint Power BI Element

In many scenarios, in case Power BI Report source data is refreshed frequently, it becomes mandatory to refresh the Power BI Reports on the page automatically. In current Power BI ShortPoint Release, there is no configuration to refresh the reports automatically. However, this workaround will help you to achieve it.



Prerequisites

  1. You have a valid ShortPoint License;
  2. You have a SharePoint page having Power BI elements embedded into it (With Master account OR Logged In User integration options);
  3. You are logged in with a valid ShortPoint user account.

Configuring auto refresh


Step 1


Navigate to the ShortPoint Dashboard (Site Settings > ShortPoint Dashboard) and click Сustomize my Site (Site customizations > Customize my site):



Step 2


Go to Utilities > Custom Javascript and paste the following script in custom JavaScript text area:


function waitForCounterToFinishLoading()
{
if(shortpoint && shortpoint.$)
{
if(shortpoint && shortpoint.$ && shortpoint.$('div[data-shortpoint-type=\'power-bi\']').length > 0){
console.log('Power BI Element found, refreshing the page after 5 mins!');
setInterval(function() {
                  window.location.reload();
                }, 300000);
}
else {
console.log('Page doesnt contain any PowerBI Element');
setTimeout(waitForCounterToFinishLoading, 30000);
}
}
else{
console.log('Page doesnt contain')
setTimeout(waitForCounterToFinishLoading, 250);
}
}
waitForCounterToFinishLoading();


If you want to apply this behavior for only a specific page and not the entire site, please use below script instead of above;


function waitForCounterToFinishLoading()
{
if(location.href.indexOf('PowerBIPage.aspx') > 0)
{
if(shortpoint && shortpoint.$)
{
if(shortpoint && shortpoint.$ && shortpoint.$('div[data-shortpoint-type=\'power-bi\']').length > 0){
console.log('Power BI Element found, refreshing the page after 5 mins!');
setInterval(function() {
  window.location.reload();
}, 300000);
}
else {
console.log('Page doesnt contain any PowerBI Element');
setTimeout(waitForCounterToFinishLoading, 30000);
}
}
else{
console.log('Page doesnt contain')
setTimeout(waitForCounterToFinishLoading, 250);
}
}
else
{
console.log('No Power BI Page');
}
}
waitForCounterToFinishLoading();


A Few Notes:


  1. Please note the highlighted text (300000) above. This is the number which indicates 5 minutes (5*60000ms). If you want to change the refresh interval for example to 1 minute, you can change above number to 60000. 
  2. For second script, please notice the page name, you have to replace that with the page name you want to apply the script for. For example, if your page is https://shortpoint.sharepoint.com/SalesReport.aspx, you should put SalesReport.aspx in the script
  3. If you are using Logged In User Integration option, you need to keep in mind that the retrieved EmbeddedToken is only valid for 60 mins. So after 60 minutes, if the page is refreshed automatically, it will ask user for credentials instead of showing refreshed report with new data. 



That's it! thank you for your attention. 


Other Articles on PowerBI


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

World's best intranet sites are designed using ShortPoint

Get started today! Learn more
See all 17 topics

Start a trial

Ignite your vision. Install ShortPoint directly on your site, or play in sandbox mode. No credit card required.

Get started today

World’s best intranet sites are designed using ShortPoint

Thousands of companies using ShortPoint everyday to design, brand and build award winning intranet sites.

Get started Learn more