Power BI embedded, direct query, not refreshing
Asked Answered
G

2

6

I have implemented Power BI embedded in a web app with direct query using Azure SQL as data source.

The Azure SQL database is being updated by webjobs and if I leave open the Power BI embedded web app I don't see the visuals refreshing with the new data unless I trigger a query for example changing tab or filtering with a slicer. In the documentation I found the following:

"If there is no user interaction in a visualization, like in a dashboard, data is refreshed automatically about every fifteen minutes."

Do I understand correctly that an open visual in my case should be refreshing without need of user interaction?

Can you point out to the reason for it not to be updating automatically? Also do you know a way to control the time of the refresh with direct query without user interaction more exactly than the "...about every fifteen minutes..."

When inspecting the connection properties on Power BI desktop I have made sure it indicates "Direct Query".

Ginnie answered 16/9, 2016 at 10:49 Comment(0)
N
2

From my understanding the embedded report won't refresh automatically. However, if you're using the Power BI JS framework (https://github.com/Microsoft/PowerBI-JavaScript) to embed your report from a Workspace Collection, then you can use a refresh() method on the report object to manually get the latest data, provided your report is using Direct Query.

This method is only present in version 2.2.0 of the framework and was then removed in the latest version (currently 2.2.1) while further testing around billing is performed (see https://github.com/Microsoft/PowerBI-JavaScript/commit/5230b2f96b10a1104efecdffe78255b9788526b8).

However, in my testing I found the session count remained unaffected by the refresh method. You can refresh up to intervals of 15 seconds (a limit set by the server). This may change however, given the method was removed in 2.2.1, but using 2.2.0 seems to work currently.

Here's a quick and dirty example which will refresh the report every minute within the allocated session:

powerbi.embed(reportContainer, embedConfig);
report = powerbi.get(reportContainer);

window.setInterval(function () {
     report.refresh();
}, 60 * 1000);

If the session expires (after 1 hour currently) then a new JWT will need to be requested and the report needs to be reloaded with the new token.

You may want to implement some checks around the session expiry if you plan to keep the report open for more than the allotted session time.

Necktie answered 13/11, 2016 at 15:20 Comment(4)
Just for complete the answer, if you embed a dashboard, no call to the refresh() method is needed (even real-time datasets are refreshed). As cmyers said, after an hour you need to refresh the JWT token.Atp
@Atp Any idea why the reports don't update automatically when dashboards do ?Von
@Von For the same reason reports are not updated in the Power BI service (app.powerbi.com). I suppose it's a design decision. You have to keep in mind that the behaviour of the Power BI Embedded is the same as the online service.Atp
Just wanted to add that the PowerBI-JavaScript team has since put the refresh method back in.Sauternes
R
0

You can achieve this by setting automatic refresh on the report. I this set to every 60 seconds.
Report Settings

But be ware there is a capacity setting for your embedded workspace for "Minimum refresh interval" and the default value for this is 5 minutes. You need to set this less than or equal to your report value. Capacity Settings - Minimum refresh interval

Reconstruct answered 8/5, 2024 at 11:22 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.