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".
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.
Related
I set up incremental refresh in powerBI, and it loaded all the history to the service, and now only refreshes the last data every time, as expected. I need to reload once all the history, because of changes made to historical data. Is there a way to do so?
If I republish my dataset from PowerBI desktop to the service, the data will be reloaded fully. Is there a simpler solution?
If your model is NOT in a Premium workspace, republishing is your only option.
If your model is published to a Premium workspace, you can manage the underlying data through the XMLA endpoint. You have to have that set up to be writable in your Power BI Admin settings. Once it's open, you can manage IR models with SQL Server Management Studio (MS doc here). There are also some third-party tools. Of these, Tabular Editor is the best. This is a video from Guy in a Cube that will get you started with TE.
If you have Premium, I highly recommend setting up all your IR tables as Dataflows. That separates the IR from your report, and makes managing IR much simpler in the long run. IR Dataflows are not available without Premium.
If I republish my dataset from PowerBI desktop to the service, the data will be reloaded fully. Is there a simpler solution?
Simpler, no. But you can force a full refresh with the Rest API.
applyRefreshPolicy Boolean true
If an incremental refresh policy is defined, applyRefreshPolicy will
determine if the policy is applied or not. If the policy isn't
applied, a process full operation will leave partition definitions
unchanged and all partitions in the table will be fully refreshed.
Modes are true or false.
My problem is very easy: I'm retrieving all stocks about lithium on the ASX market from this web page.
I created a Power BI dashboard that you can visualize here.
As the source is Web I would like to refresh it every day using the Gateway connection, so I have successfully installed it on my computer that I turn on every day:
The problem is that instead of a successful daily refresh I have a daily error:
Failed to test the connection to your data source. Please retry your credentials.
Some credentials aren't validated as they are set to skip test connection.
If I enter in the Edit credentials I see the error:
Failed to update data source credentials: The credentials provided for the Web source are invalid. (Source at https://www.marketindex.com.au/commodities/lithium.)Show details
This because I'm using Authentication method: Anonymous and Privacy level setting for this data source: Public. But this is exactly what I'm using on Power BI desktop and it's working!
What am I doing wrong here?
Why the same connection is working fine on Power BI Desktop but not the same dashboard uploaded online?
EDIT: the On-premises data gateway looks installed without problems
It seems like the issues you're experiencing may be caused by the link you're using (https://www.marketindex.com.au/commodities/lithium), although I'm not sure exactly why.
For example, as has been mentioned in the Do I Need a Gateway for Web post, one can use Web.Contents instead of Web.BrowserContents in the raw M code in the Power Query Editor to avoid using a gateway. However, when I test this implementation using the link that you provide, I get an error when refreshing from Power BI online.
If I test this implementation using an HTML table from the https://tradingeconomics.com/commodity/lithium website, though, and set the data source credentials as follows, then I am able to successfully refresh the dataset from Power BI online.
I tested this with another HTML table from a random webpage and an online refresh worked as well. So it seems like there is something odd about how Power BI online interacts with the Market Index website and this is causing your issue. Potentially because of some authentication configuration on the Market Index side of things? I'm not able to help with looking further into why this is occurring, though.
Would you be able to use a different website with similar information as a data source for your report? If so, you could avoid the issues you're experiencing and avoid using a gateway in general if you wanted.
If you go this route, it seems like using the included "Scheduled refresh" setup in Power BI online works, but I will include the Power Automate scheduled refresh setup below in case this is desired instead.
Power Automate Scheduled Refresh
One can use Power Automate to "schedule" dataset refreshes instead of the included "Scheduled refresh" functionality in Power BI online. The steps are a little too long to include here, but the Refresh your Power BI dataset using Microsoft Flow article outlines the process on setting this up. There are various triggers that you can use to trigger your flow. The linked article uses one that triggers based on a SharePoint action, but there is a Recurrence trigger that can be used to trigger your flow at regular intervals/times.
Just set up your flow, make sure that it is "turned on", and your dataset will refresh at regular intervals from the cloud.
I haven't done any changes in my dataset for a while and in the past few days, the refresh and publish features (via PBI Desktop) were working just fine. However, this morning, it suddenly stopped following through the scheduled/automatic refresh which were set 5x a day every 2 hours starting 8AM. When Itrigger manual refresh, it says "Preparing for refresh" but doesn't really follow through with it, so i kept on clicking it but to no avail. After a while, I checked the Refresh History and the error I got was it's timing out.
I was trying to republish it with a newer version which was the same dataset refreshed in a different workspace. Apparently, when I publish it to a different workspace, or if I rename it and publish it to my existing shared workspace, it works. BUT I don't want to push through with this kind of workaround because I cannot afford to redo my the set up of RLS and manage permission in the dataset of my existing workspace.
Hope you can help me on this. Thanks.
Try signing in to the workspace using a browser, then use the Get Data feature (arrow button at bottom left), then choose Files / Local File and select your PBIX.
It's effectively the same results as a Publish from Power BI Desktop, but sometimes the method above works when Power BI Desktop is jammed up.
You might also have a refresh issue, not a publish issue. There's an unannounced-refresh-on-publish feature that most people don't notice:
"When you republish a dataset published from Power BI Desktop and have a refresh schedule defined, a dataset refresh is started as soon as you republish."
https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-upload-desktop-files
I'm new to Power BI (Free Version) and I have been asked to develop a report system which generates report from an excel sheet, the reports work good for only the data I have collected.
but my question is how to connect to the data immediately from SQL server without the need to convert it to excel and then import it in power BI, I also want the data to be refreshed dynamically.
One of the solutions I tried is to add new dataset but I get the following message:
Refresh can't be scheduled because the data set doesn't contain any
data model connections, or is a worksheet or linked table. To schedule
refresh, the data must be loaded into the data model.
I have looked for many solutions but none has worked.
am I missing a concept? thank you
If this data is stored in a SQL SERVER table it is a pretty straight forward process.
When you create a new power bi report (.Pbix) you should see a prompt asking you if you want to "Get Data". You would select the 'SQL Server Database' option - See the image below:
Then, you will be asked to enter the Server and Database name, and to specify either 'Import' or 'Direct Query' mode. If you choose 'Import' the data will be refreshed every time you access the report or upon 'Refresh' within a report session. If you choose the latter, the connection will always be live i.e. any changes to the data in your database will be reflected in the report.
Once you get passed this window, you will be asked to either specify credentials or use a windows authentication to access the database and server. After that you can either specify a query to pull in some data or you can select from a list of tables.
I hope this helps!!
I have created a streaming+push dataset in power BI. And i push the data through the rest apis. I can see the dashboard in power BI getting updated with the latest data. But the embedded report in my website doesn't seem to update.
How can we achieve this? Is there any additional configuration required when embedding the report?
Power BI Reports hold a special property that does not allow them to refresh during viewing\editing. This is mainly to allow for presentations & editing, without having to worry about data changes.
However, one can refresh the report view in powerbi.com using the refresh button.
In Power BI Embedded, the developer can periodically call report.refresh() in the JS SDK to simulate the same action. Time intervals can be synchronized with the known realtime streaming times up to a limit.