Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

SamWiseOwl

Extracting data from visuals using Power Automate

Power BI can connect to, transform and visualise data. Which is great but how do we get that modified data out?

One way is using a Power Automate flow to connect to the published Power BI dataset.

image_0001.png

Take this Power BI table visual, I want to extract this data.

First thing we need is to extract the DAX behind the visual. To do this go to View | Performance analyzer and toggle this on.

image_0017.png

When you click Performance analyzer a new pane will appear on the right. 

The analyzer lets you see information about each visual on the page like load times. Click on Refresh visuals button.

image_0018.png

Clicking Refresh visuals loads all visuals on the current page.

Click on the + icon by the table visual and choose Copy Query to add the DAX code to your clipboard.

image_0019.png

We now have the code Power BI uses to generate the visual.

 

Now we can open Power Automate in the browser and create a flow to extract the data using the copied script.

Create a new flow by clicking on New flow | Instant cloud flow.

image_0005.png

You can choose from several triggers but here we will choose Instant cloud flow. 

 

Give your flow a suitable name and choose Manually trigger a flow to create your new flow.

image_0006.png

Manually triggered flows run when you choose but there are other options. 

 

This will open up your designer where you create all the steps of the flow. Click on the + to add a new step.

image_0007.png

Choose Add an action to see a list of the available options. 

 

Search for Run a query against a dataset and you should see it under the heading Power BI.

image_0008.png

We want to run the query copied earlier. 

 

Select the Workspace and Dataset of your published report, then paste the code from your clipboard into Query Text.

image_0009.png

Power Automate will run the code against the specified dataset. 

 

Now in the top right choose Save and then click on Test to run your flow.

image_0020.png

You must save before selecting the Test option.

If you have run this flow before, you can choose Automatically to re-run with previous data.

For now choose Manually and select Test to try your new flow.

image_0011.png

You can run the flow by clicking Test.

 

We should now see each step with a tick next to it. You can now select the Power BI step to see the returned data.

image_0021.png

Click on the last step to see more information.

Each step has an Inputs and Outputs section and by choosing Show raw outputs we can see our data.

image_0012.png

Clicking here will show you a JSON file of the returned information.

 

Now you can see all the returned data in the body section of the output.

image_0016.png

The headers section includes useful information like run Date.

 

From here we can put this data into a CSV table.

SamWiseOwl_0-1731936910848.png

Use Create HTML table to include in the body of the email or CSV as an attachment.

 

To include the data click on the lighting bolt to add dynamic content and choose First table rows.

SamWiseOwl_1-1731937012910.png

You could run this step multiple times to attach more than 1 file.

 

Now we can add the final step: Send an email (V2)

 

SamWiseOwl_2-1731937114329.png

Here I am using the Office 365 Outlook connector.

 

To include this file as an attachment expand the Advanced parameters section.

SamWiseOwl_3-1731937239966.png

We want to choose Attachments, this could do all the CSV files at once.

 

Last step is to choose the Output of the Create CSV table step as the Content.

SamWiseOwl_4-1731937398036.png

If using HTML table the output can go directly into the Body of the email.

 

Fill in the remaining fields and give this a run and enjoy your lovely email.

SamWiseOwl_5-1731937594667.png

Maybe spend more time on the Body and Subject sections...

 

I hope this helped and you keep enjoying the Power BI experience!

Comments