cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sa7
Helper I
Helper I

PowerAutomate group by user name when all items are updated to approve, calculate average send an email

I have a SharePoint list where it is stored for users evaluations, a single user can have multiple evaluations. Initially all the evaluations are in pending stage. Evaluator have a powerapps form where they can take the evaluation and give the score for each evaluation once he submit the response it it will go to approve status. Now I need to trigger an email, Once all the evaluations are approved belongs to single user along with the average score.

First I need to group by user name

Second check if those items are in approve status

Then calculate the average score 

Then send an email to user

How do I achieve this using power automate.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ScottShearer
Super User
Super User

@Sa7 

I would approach your requirement as follows:

  1. Use a When an item or file is modified trigger
  2. Initialize a variable to store the accumulate scores
  3. Immediately after the trigger, check to see (condition) it the status is approve
    1. If the status is not approve, use a control terminate action (with success) to stop the Flow
    2. Alternatively, you could use a trigger filter instead of the condition
  4. Use a Get items action with a Filter query so that only items for that use are returned
  5. Loop through the items returned
    1. If any are not approved, exit the Flow with a control terminate action
    2. Add the score to the variable
  6. Divide the sum of the scores stored in the variable by he number of items returned 
    1. Use this expression to find the number of items returned by Get items:
      length(outputs('Get_items')?['body/value'])
  7. Send an email

Give this a try and let me know if you need additional help.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

2 REPLIES 2
ScottShearer
Super User
Super User

@Sa7 

I would approach your requirement as follows:

  1. Use a When an item or file is modified trigger
  2. Initialize a variable to store the accumulate scores
  3. Immediately after the trigger, check to see (condition) it the status is approve
    1. If the status is not approve, use a control terminate action (with success) to stop the Flow
    2. Alternatively, you could use a trigger filter instead of the condition
  4. Use a Get items action with a Filter query so that only items for that use are returned
  5. Loop through the items returned
    1. If any are not approved, exit the Flow with a control terminate action
    2. Add the score to the variable
  6. Divide the sum of the scores stored in the variable by he number of items returned 
    1. Use this expression to find the number of items returned by Get items:
      length(outputs('Get_items')?['body/value'])
  7. Send an email

Give this a try and let me know if you need additional help.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Sa7
Helper I
Helper I

@ScottShearer Thanks for the inputs. It worked but with slight changes I believe.

It took very long time for me to figure out how to terminate loop if any of the status is pending but any way

Thanks for your support!

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (2,062)