Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Use Automate to send a daily email only if a power bi database refresh succeeded

Hey there!


Making a automated daily infographic for my company.   Every once in a while the scheduled refresh will fail (usually a error with getting the data report from our companies database).      I dont want my daily report to send if the database did not refresh properly.   Currently i have Power BI report subscribed to send to my own email, then i use power automate to download the .png attachment and use html code to put it in the body of a sent email in a nice and clean finished report.   


I was playing around with conditions for it to see if i got a "refresh failed" email that day but i couldnt figure it out.  Is there a way you may know about to conditionally run the power automate, or subscribed report daily?   

New Member

Yes, you can add a condition to your Power Automate flow to check if the data refresh was successful before sending the email with the Power BI report.

Here's an example of how you can do this:

  1. Add a "Recurrence" trigger to your Power Automate flow to run daily.
  2. Add an action to the flow to get the refresh history of the dataset from the Power BI API. You can use the "HTTP" action and call the "Get Refresh History In Group" API endpoint. You will need to provide the Group ID and Dataset ID for your Power BI report in the request URL.
  3. Parse the response from the API using the "Parse JSON" action to extract the status of the last refresh.
  4. Use a condition action to check if the status of the last refresh is "Succeeded". If it is not, then you can end the flow without sending the email.
  5. If the refresh was successful, then add the actions to download the PNG attachment and send the email with the report as you currently have in your flow.

Here's a sample JSON schema for the response from the Power BI API that you can use in the "Parse JSON" action:


"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"startTime": { "type": "string" },
"endTime": { "type": "string" },
"status": { "type": "string" }
"required": ["id", "startTime", "endTime", "status"]


You can use the "status" property to check if the last refresh was successful.

ooooh this seems promising!   Never ran aything like this so it may take a bit, but ill follow up when i figure it out 🙂

Helpful resources

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Kudoed Authors