How to create a Task using a PowerBI Supporting Report using SQL queries (with example)?

How to create a Task using a PowerBI Supporting Report using SQL queries (with example)?

FIRST CREATED ON 13 October 2025  I  AUTHOR Emma Camacho

Following the example How to create a Word report using PowerBI as a data source in Mail & Deploy (with example)? we are ready to send the Reports to the Store Managers. The following screenshot is the Supporting Report created to manage the Store Manager recipients. You can use the attached Excel file to create it. The Flag field indicates who wants to receive an email and who doesnt.



the Task looks like this:


Let's expand the actions:

CYCLE OVER VALUES


EvaluateSqlDatasourceExpression( "M&D Demo_Supporting Report", "SELECT  * FROM  [M&D Demo_Supporting Report].[Model].[Store Managers] ", 1 )
For more information, see EvaluateSqlDatasourceExpression.

You will gain access to the whole row of the table using the CycleValue and expression Value, for example,  [CycleValue].[Store].Value("Email") to get the current Email.

OUTPUT DEBUG INFORMATION


"Cycle over values: " & [CycleValue].[Store].Value.ToCsv()

This action is just for debugging purpose. The expression ToCsv() will display the whole row separating the fields value with a comma. The execution log will display something like this:

GROUP

[CycleValue].[Store].Value("Flag")=1

Only send emails to Store Managers that want do receive emails.

CREATE REPORT DOCUMENT


The Report is designed to receive as a Parameter the name of the Store. The Report itself will filter (using the WHERE clause) the tables to the Parameter.

Send E-Mail






The Report's filename will be the name of the Store and it will be sent to the corresponding Email.
The Cycle will go through all the Stores in the Supporting Report and all the Store Managers with Flag = 1 will get a Report.

Info
Looking for Additional Guidance?

If you require more detailed information or further assistance, please visit our comprehensive Online Documentation. Our resources are designed to help you navigate all features and functionalities effectively.