web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Building Flow Using Po...
Power Automate
Unanswered

Building Flow Using Power BI Results Table

(0) ShareShare
ReportReport
Posted on by 62

Hi everyone, I am trying to create a power automate flow which will send out emails to various different store managers. The issue I'm having is that I want to send the store information to the manager of that store as well as their results but do not want to set up a separate flow for each store, I would like them all to run from a single flow.

 

My Power BI data looks like the following:

DateStore NameItem CodeSalesSales TargetStore Manager NameStore Manager EmailStaff Employed
01/01/2024City A1000167AprilApril@zzz.com5
01/01/2024City A1000294MayMay@zzz.com5
01/01/2024City A1000345LeoLeo@zzz.com5
01/01/2024City B1000122MikeyMikey@zzz.com3
01/01/2024City B1000204DonDon@zzz.com3
01/01/2024City C1000257RaphRaph@zzz.com2
01/01/2024City C1000399JuneJune@zzz.com2

 

For store A, I would like to send the following results:

DateStore NameItem CodeSales
01/01/2024City A100016
01/01/2024City A100029
01/01/2024City A100034

 

Since I am using Power BI, the flow I currently have looks like the below. I have no issue bringing in the table for each store but wish I could run a loop. That way I can get the email address from the data stored in Power BI and then bring it into the 'Send an email' portion of the flow. I would also like the data to filter to that store so City A's store only gets their results. Is this possible or is it too much?

MyFlow.PNG

 

 

Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at
    Re: Building Flow Using Power BI Results Table

    Hi , @BrewerHaHa 

    Do you mean you want to send email to "April@zzz.com;May@zzz.com;Leo@zzz.com" for this html table:

    vyueyunmsft_0-1709268012453.png

     

     

    Best Regards,

    Yueyun Zhang

  • BrewerHaHa Profile Picture
    62 on at
    Re: Building Flow Using Power BI Results Table

    Yes that is correct, apologies, I will update the post now

    If we can send emails to even 1 of the managers, that will be good.

  • Verified answer
    v-yueyun-msft Profile Picture
    on at
    Re: Building Flow Using Power BI Results Table

    Hi , @BrewerHaHa 

    Thanks for your response! This is my test data in Power BI and the return for the "Run a query against a dataset" in flow:

    vyueyunmsft_0-1709270213779.png

    This is my test flow:

    vyueyunmsft_1-1709270227366.png

    (1)The select action:

    vyueyunmsft_2-1709270338498.png

    item()?['Table[Store Name]']

     

    (2)The Apply to each action:

    The union() function is used to get the no duplicate store name lists.

    vyueyunmsft_3-1709270542315.png

     

    union(body('Select'),body('Select'))

    item()?['Table[Date]']     ===== item()?['Your field Name']

     

    join(xpath( xml(json(concat('{"root":{"item":',body('Filter_array'),'}}'))) , '/root/item/Table_x005B_Store_x0020_Manager_x0020_Email_x005D_
    /text()'),';')

     

    This expression is used to get the all the managers in one store.

    vyueyunmsft_4-1709270744816.png

     

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

  • BrewerHaHa Profile Picture
    62 on at
    Re: Building Flow Using Power BI Results Table

    Hi @v-yueyun-msft 

     

    Thank you for your detailed response. I'm very new to Power Automate. Where do I get the return for the "Run a query against a dataset" in flow? Is this from the Paramaters -> Outputs -> Body section that you can get to once the flow has been run?

     

    Also my data is sent on a schedule, so it may show the data from last week dynamically. Will this option still work?

  • v-yueyun-msft Profile Picture
    on at
    Re: Building Flow Using Power BI Results Table

    Hi , @BrewerHaHa 

    You can see the run flow history here:

    vyueyunmsft_0-1709272977733.png

    If your flow is triggered on a scheduled basis, the stream will send the data that was retrieved at the time of the trigger.

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

  • BrewerHaHa Profile Picture
    62 on at
    Re: Building Flow Using Power BI Results Table

    @v-yueyun-msft Thanks so much for your assistance. I will check whether or not I am able to implement this solution tomorrow. I will update this thread as I go along.

  • v-yueyun-msft Profile Picture
    on at
    Re: Building Flow Using Power BI Results Table

    Hi, @BrewerHaHa 

    Thanks for your response! Of course, you can test it on your side now. If you have  problem, you can send me in this case.

    The next two days are weekends, and I will get back to you as soon as possible in Monday.

     

    Best Regards,

    Yueyun Zhang

  • BrewerHaHa Profile Picture
    62 on at
    Re: Building Flow Using Power BI Results Table

    Hi @v-yueyun-msft 

    I just tried this and was unable to manage to get this working but I can tell it's very close!

    I could not do exactly what you did so I had to make some changes to see if I could get the flow to run. When I tried to run it, I had 2 issues.

    a) My first issue is was in the 'Apply to each' step. In this step I got an error saying 'ActionFailed. An action failed. No dependant actions succeeded.'

    I think this is because I didn't implement the code here which is 

    union(body('Select'),body('Select'))

    item()?['Table[Date]']     ===== item()?['Your field Name']

    Does the second line with the date table also go into this step? If it does, which column do I use for 'Your field name'? If it does not go to this step, does it go somewhere else? I put a screenshot below of what I currently have in this section to hopefully help.

    BrewerHaHa_0-1709445933781.png

    b) I also had an error in the 'Create HTML table' step. I knew that it would not go well because when I clicked on it and tried to find 'Body' as an option, it was not available. I tried to use 'First table rows' instead but this did not work when I tried to test the flow. Is the reason I cannot see 'Body' as one of the options because of the 'Apply to each' part of the flow being incorrect? I have another screenshot below and the error given to me is:

    'InvalidTemplate. Unable to process template language expressions in action 'Create_HTML_table' inputs at line '0' and column '0': 'The template language expression 'outputs('Filter_array')['body/firstTableRows']' cannot be evaluated because property 'body/firstTableRows' doesn't exist, available properties are 'body'. Please see https://aka.ms/logicexpressions for usage details.'.'

    BrewerHaHa_1-1709446207305.png

     

     

     

  • BrewerHaHa Profile Picture
    62 on at
    Re: Building Flow Using Power BI Results Table

    @v-yueyun-msft 

    I also just tried this

    union(body('Select'),body('Select'))
    item()?['Date Table[Date]'] ===== item()?['Test Table[Date File Loaded]']

    in the 'Apply to each' step but I am getting the error 'The input parameter(s) of operation 'Apply_to_each' contains invalid expression(s). Fix invalid expression(s) for the input parameter(s) of operation 'Apply_to_each'.' when I try and save this flow

    BrewerHaHa_0-1709516048844.png

    I am guessing that this is incorrect. Is this code

    item()?['Table[Date]']     ===== item()?['Your field Name']

    meant for the step 'Create HTML table'?

     

  • v-yueyun-msft Profile Picture
    on at
    Re: Building Flow Using Power BI Results Table

    Hi, @BrewerHaHa 

    Thanks for your quick response! For your question, this is my understand:

     

    (a) The "union(body('Select'),body('Select'))" code has no error. And this is put it in the Apply to each :

    vyueyunmsft_0-1709516609761.jpeg

     

    And the "item()?['Table[Date]']"  ===== item()?['Your field Name'] code is put in the "Create HTML Table" action:

    vyueyunmsft_1-1709516609767.jpeg

     

    This is used to custom the Html table column name and values. 

    The "Your field Name" you can find in your flow run history in the output of your "Run a query against a dataset" action.

    vyueyunmsft_2-1709516609770.jpeg

     

    (b) The Apply to each action return error code means one of the action in its return error. You need to check if your "Filter array" return successfully which is used to filter the array by the Store Name:

    vyueyunmsft_3-1709516609772.jpeg

     

    And you said that your "Create Html table" return error code (property 'body/firstTableRows' doesn't exist), i recommend you to change to the old designer:

    vyueyunmsft_4-1709516609773.jpeg

     

    This error code is your "outputs('Filter_array')['body/firstTableRows']" code is wrong, you need to use the   body('Filter_array')   

    vyueyunmsft_5-1709516609775.jpeg

     

     

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard