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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Number or rows vs targ...
Power Automate
Answered

Number or rows vs target- Monthly email notifications

(0) ShareShare
ReportReport
Posted on by 47

Hi,

I would like to consult on how or if this is possible at all.

I have 2 lists that are updated via Power Apps. 

Those lists contain: 

  • List 1: list of individual records a person will update on an ongoing basis
  • List 2: a list where a person updates a yearly target number. 

The end result is to have a scheduled email to notify this person if they are reaching their target, how much left with a link to the app. 

 

I have tried several workarounds with no luck. 

Can anyone assist with trying to make this work? 

 

For example:

Manager 1's name is listed in a person column in list 1 and created 29 records. 

Manager 1's name is listed as string in list 2 (title column) and in the "Target" column they entered 35. 

Manager 1 should receive a status on a monthly basis regarding the records vs target. 

 

Thanks in advance!

Oren

Categories:
I have the same question (0)
  • Manish Solanki Profile Picture
    15,167 Moderator on at

    Hi @orengaliki 

     

    The ask is to send notification to a user if target column value is less the total no of records in list 1 for each user. Pls confirm.

     

    Thanks

  • orengaliki Profile Picture
    47 on at

    Hi, 

    The goal is to present a status for the user in an email notification, for example:

    "Dear user (DisplayName),

    Note that you need to complete 2 more reviews to meet your target - (target value)".

     

    In short, if the total count in list 1 is less than the target in list 2 for the user, then a scheduled notification should send them on a monthly basis. 

  • Verified answer
    Manish Solanki Profile Picture
    15,167 Moderator on at

    Hi @orengaliki 

     

    I have created 2 lists: List 1 & List 2. List 1 has 2 columns 'Title' and 'Manager' (people or user field) & List 2 also has two columns "Title" & "Target" (number type).

     

    Here are the detailed steps for designing the flow:

     1. Firstly, create recurrence flow and configure it to run on monthly basis:

    ManishSolanki_0-1690098095963.png

     

    2. Next, we will fetch all the records from List 2 using 'Get items' action:

    ManishSolanki_5-1690098629596.png

     

     

    3. We will add all email addresses in an array using 'Select' action. The input of select action will the output value object array from 'Get items' and click on 'Switch Map to text mode' button on the right side:

    ManishSolanki_2-1690098375972.png

    Next, choose 'Title' column from the Dynamic content :

    ManishSolanki_3-1690098482784.png

     

    4. Next, we will fetch all the records from List 1 using 'Get items' action:

    ManishSolanki_6-1690098690299.png

     

    5. Next, we will find the distinct name by writing an expression using union() function and iterate those using 'Apply to each' action:

    ManishSolanki_7-1690098824343.png

    Expression used for finding the distinct name from "Select" action output:

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

     

    6. We will save iterated item (name) using compose action:

    ManishSolanki_8-1690098955030.png

     

    Continue inside "Apply to each" box, add 2 filter array action to filter out records from both list for the current item (name) in each iteration:

    ManishSolanki_9-1690099208732.pngManishSolanki_10-1690099316441.png

     

    7. Now, we will add a Condition action to check if Target column in List 2 is less than the count of rows in List 1:

    ManishSolanki_11-1690099506213.png

    Expression used for left hand operand:

    length(body('Filter_array'))

    Expression for right hand operand:

    first(body('Filter_array_2'))?['Target']

     

    8. If condition is true, then we will send an email to the user in "Yes" path:

    ManishSolanki_12-1690099735854.png

    Expression used for determining the email recipient:

    first(body('Filter_array'))?['Manager/Email']

    Expression for finding the target deficit:

    sub(first(body('Filter_array_2'))?['Target'],length(body('Filter_array')))

     

    It is quiet complex & lengthy but will help you in designing the required flow 🙂

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

     

  • orengaliki Profile Picture
    47 on at

    Thanks a lot for all the efforts and time! 

    I have tried step by step and got the following error: 

     

    InvalidTemplate. Unable to process template language expressions in action 'Send_an_email_(V2)' inputs at line '0' and column '0': 'The template language function 'sub' expects its first parameter to be an integer or a decimal number. The provided value is of type 'String'. Please see https://aka.ms/logicexpressions#sub for usage details.'.

     

    orengaliki_1-1690105543778.png

    How can I pin-point the issue? 

    Maybe this means that the criteria was not met? although the expression is true. 

     

    orengaliki_2-1690105621035.png

     

  • Manish Solanki Profile Picture
    15,167 Moderator on at

    Hi @orengaliki 

     

    Pls share expression used for 'sub' formula in email body.

     

    Thanks

  • orengaliki Profile Picture
    47 on at

    Hi 

    this is the expression:

    orengaliki_0-1690114772785.png

     

     

    and this is the column name at the target list (list 1)

    orengaliki_1-1690114818576.png

     

  • orengaliki Profile Picture
    47 on at
    sub(first(body('Filter_array_2'))?['Target'],length(body('Filter_array')))

     

  • Manish Solanki Profile Picture
    15,167 Moderator on at

    HI @orengaliki 

     

    As 'Target' column is of single line of text, so we need to convert it into integer before performing subtraction operation. Below is the updated expression to be used in the email body:

    sub(int(first(body('Filter_array_2'))?['Target']),length(body('Filter_array')))

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • orengaliki Profile Picture
    47 on at

    You are the best ! 

    Works perfectly! 

    Many thanks! 

     

    If I would like to have another filter, reviews per quarter for example, that list 1 contains single line of text and list 2 contains a drop-down list with the same values (the values in list 1 are added via PowerApps, so no issues with spelling 🙂 ). 

     

    As the process seems a bit tricky, I would appreciate your guidance on how to add another filter .  

     

    End result will be that at the beginning of each quarter, the above email will be sent when calculating the target vs review rows added, as the manager will add rows in advance. 

    It's all about showing the status 🙂 

     

  • orengaliki Profile Picture
    47 on at

    Well, I spoke to soon... 

    There is an issue with the counting of the reviews already in list 2. 

    I have copied the same expression to the email body: 

    orengaliki_1-1690137403512.png

     

    and this is the result:

     

    orengaliki_0-1690137332858.png

    the target reflects well, only it does not substract the row numbers associated to that manager. 

    For the person in the list there are 18 reviews updated, so I do expect the email to show that there are 2 more left from the target of 20. 

     

    Thanks and sorry for the long process... if only Microsoft could make this easier.

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 227

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard