When taking a look over your Power BI dashboards, reports and apps, do you ever have a need to have a bit more control over data? Do you ever need to say make some changes or trigger a process?
In this blog post, I’m going to show you how to set up a button in your Power BI reports to trigger a cloud flow right from your data dashboards!
If you like this content, make sure you subscribe to get emails on daily posts about Microsoft 365, Power Platform, Low Code and more!
Bringing some data into my report
So first I’m going to start right from a blank report in Power BI desktop and I’ll start by bringing in a list from SharePoint online.
I’m going to select the Get data button and then look for SharePoint Online.
I’m going to select SharePoint Online List, then I’ll provide the dialogue with my site URL, and finally I’ll click ok.
The next thing we need to do is authenticate. I’m going to select Microsoft account to do this, and I’ll need to sign in using a Microsoft 365 account which has access to the SharePoint site my list is in.
Once you’ve signed in, click connect.
Now you’ll see the navigator open which will show you all of the tables in your site. Let’s find out list and select it to load. I’m bringing in my Issue tracker.
Creating a flow
Now we’ll start to build our flow. Let’s add the Power Automate visual to our report and add any fields from our data into it, that we’ll want to use in our flow.
Now to start building the flow we’ll select the three dots on the visualisation and then select edit.
Now you’ll see Power Automate open up within your Power BI report. From here you can select one of the templates or you can select new and then choose to pick a template or build a new instant cloud flow
I’m going to select Instant cloud flow which will provide me with the Power BI trigger, “Power BI button clicked”. This trigger will pass in any of the fields we added to the visualisation in our report, through to our flow as parameters which then become dynamic content.
Taking a look at the dynamic content we get out of our trigger. The primary content is the user information, the timestamp and the fields we get that we added to our visual. Using the user content we can see contextual information about who clicked the button in our report to trigger the flow, and we can see exactly when they did it.
Then following this we’ll have the fields the report builder added to the visualisation which are presented as ‘Power BI data [field]’.
Apply to each?
So if you’ve added one of the fields to your flow that you passed in by adding it from the report fields to the visual, you’ll notice you’ve got an apply to each. Yes, Power BI is passing in an array. What this array contains however is dependent on the person triggering the report and the filters they’ve applied to the report.
For example, if I have a table visual and I select a single record which my report filters down to, then that will be the only record that gets passed into my flow and so I’ll only be taking actions based on that one record in my flow.
Let’s test this out…
Here in my report I’ve selected a single record in my table visualisation and then I’ve selected my flow button to trigger it.
Now taking a look at the run history of my flow you can see that I’ve only got one record in my array which my apply to each has processed.
In contrast, without selecting a record in my table visualisation, you can see I get my full array of data.
There you go! Now you’ll just need to apply the logic you want in your flow to achieve your requirements. You can take a look at my Power Automate blog posts for support with building flows, or if you’ve got any questions drop them in the comments to me.
You should note that at the time this blog post was published this feature is in public preview. There are a number of things not yet supported by this feature including
- Environment switching
- Adding additional input parameters to the trigger of your flow
- Only working with a single record and not working with an array – See this post for a slight work around