One of the new cool integrations between Power BI and Microsoft Flow is the ability to trigger actions based on Power BI alerts. For example, I’m going to imagine I’m the CEO of a company and I want an email alert whenever Profit falls below a certain threshold. I have an existing Power BI desktop dashboard that looks like the picture below and I’ve decided that I want to receive an email notification whenever my profit drops below $14 million.
To create data-driven alerts there are a few requirements:
- Have a Power BI Pro license (requirement for some of the features being demonstrated)
- On-premise data gateway configured – https://powerbi.microsoft.com/en-us/gateway/
- Signed up/Enabled Flow for 0365
With these in place I’ll be doing the following:
- Publishing the report to the Power BI service
- Creating a dashboard
- Creating an alert on a pin on the dashboard
- Configuring Flow to email on the alert
To get started I published the report above to my Power BI default Workspace:
Next, I pinned the cards to a dashboard:
A quick view of the dashboard shows a couple of the cards I pinned:
Here is the dashboard:
Now I need to create a Power BI Alert by clicking on the ellipses … in the upper right-hand corner of the card
I’ll add the alert to the Profit card and set the following values:
Maximum notification frequency: At most every 24 hours
Then save and close
Now that I have the alert configured I will log into Flow – https://flow.microsoft.com/en-us/ and select Create from blank
I searched for Power BI and select the “When a data driven alert is triggered”
Since this is tenant based it automatically finds my Power BI alerts that I’ve created so it’s a simple matter of selecting the Alert for Profit alert I created in Power BI.
Click New step
Select Add an action
As I want to send an email alert to myself, I searched for email actions and found plenty. You, of course, could search for other actions.
And then configured the alert with my email address and the values I was interested in. Then I clicked Create flow to complete.
Once the flow completes creating select Done.
If you select Manage you’ll see the created flow –
Now to get the alert to trigger I went back to my on-premise SQL database and ran the following statement to modify the profit amount:
DELETE FROM InvoiceDetails
WHERE SalesAmount > 999
Then I refreshed the Power BI online data source:
Here we can see the refresh triggered the Alert in Power BI:
And here is the email I received:
In a short amount of time with Power BI and Microsoft flow email alerts, I can quickly get insights into my data! One thing to keep in mind is that the alerts are only triggered through the data refreshes. During the refresh, the threshold criteria are analyzed and the alert triggered if the condition is met.