Forum Discussion
Get a field in one list from a field and add
Hi oslecat , I would approach this in a slightly different way. I would have a list which contained the employee name, unique ID (likely the email address) and a column titled 'total_leave_allowance' to contain the annual allowed days.
Your second 'request' table would store all requests as they come in and would have a multi-select field titled 'approved_refused'.
When a request is submitted your Flow would get the annual allowance from the first list, then all approved (and likely pending) requests from the second list using the employee ID and status (approved/refused) as your filters in the query part of the Get items action.
Next your Flow would use an array to consolidate all matching items returned and sum the approved (and likely pending approval) requests. You can find a useful guide to using an array to sum values here: https://www.tachytelic.net/2021/06/power-automate-instant-sum-array/