Refresh Power BI Datasets using Microsoft Flow
Power BI is a very popular business analytics tool that provides democratized access to building reports and dashboards. A fundamental component to building Power BI reports and dashboards are datasets. A dataset keeps a copy of Power Query transformed data in the Power BI service so that when requests are made to Power BI, reports and dashboards respond quickly.
For Power BI shared-capacity subscriptions, data refreshes can be scheduled, but are limited to 8 refreshes per day. However, the Power BI documentation indicates: “On-demand refreshes are not included in the refresh limitation”. Beyond the number of refresh limitations, you may have business needs that require an on-demand refreshs to be triggered from another system.
Power Automate is a great tool to start these on-demand dataset refreshes. In October 2019, Microsoft added a new action to the Power BI connector called Refresh a dataset that will start a dataset refresh.
Using a Power Automate button is a great way to kick off a flow that will call this action. It is important to note that the Power BI connector will start the dataset and an HTTP status code of 202 (Accepted) is returned to flow almost instantly. This is an asynchronous process as the dataset may take a few minutes to refresh.
If we look in in the Power Bi dataset Refresh history, we will discover our last refresh was triggered On demand by Power Automate.
Note: Something to be aware of is that if you try to execute an on-demand dataset refresh that overlaps with a scheduled refresh, you will encounter the following error: “Invalid dataset refresh request. Another refresh request is already executing”.