If you have a send email action inside of a for each loop that's iterating through each item, it's going to send an email for each one.
The way I've created scheduled reports to run in cases like this to pull a filtered list of items that need to go into the report. Add a condition to terminate or skip the email if there's no items returned from the query. Map desired data point values from the items to human readable headers using a "Select" action. Use a "Create HTML Table" action to convert the Select mapping to an HTML table, and finally drop the HTML table into an email.
So for you, if the idea is to send one email with two lists you could do it like this:
1. Create a Get Items list for your first condition past due items--write a good filter to only pull those items that qualify.
2. Create a Select operation that takes the value array from this action and maps your desired data points to display in the email. (for example:
{
"Project Name": @{name_field_reference},
"Status 1 Planned": @{status_1_planned_date}
}
3. Add a Create HTML action and input the Select Action output to it. This will create an HTML table that's viewable on a website or an email.
4. Create another Get Items list for your second condition past due items--write a good filter to only pull those items that qualify.
5. Create another Select operation just like the first one except pull in the other date field(s)
6. Create another "Create HTML" action to conver this Select mapping to another HTML table.
7. Add your Send Email action. Write out a body template, you can add headers for each html section. Then toggle to html view and drop in the dynamic outputs of each of your HTML action outputs in the appropriate spot.
Something like:
Now whenever your flow runs it'll just send out one email. You can finess it to include links to each item in the tables, and also to not send an email if there are no overdue projects found, etc.
If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!
Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff | YouTube: Mark's Power Stuff |