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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Loop to Deduct ...
Power Automate
Unanswered

How to Loop to Deduct Leave Balance

(0) ShareShare
ReportReport
Posted on by 997 Super User 2024 Season 1

Hi, I have this 1 list for admin to add new leave types.

anonymous21_0-1660036252263.png

Right now I'm doing if an item's status is 'Approved' in the Leave Request list, it will then subtract the leave balance for that particular employee and leave type. For example, ABC applies for a Sick Leave for 2 days and it has been approved by his approvers. ABC's original leave balance for Sick Leave is 4 days so when his application is approved, his new leave balance is 2 days. It creates issues for me to update ABC's leave balance as I can't use the switch to determine which leave type ABC has applied because the admin could be adding new ones. It also creates issues to subtract for each leave type.

How to solve these issues?

 

anonymous21_1-1660036759849.png

This is my previous method to deduct the leave balance and it uses a switch for the leave type.

 

Thank you.

 

 

 

Categories:
I have the same question (0)
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @syhrh  Use get items for leave types and use filter query so that if it is new leave type get items will return result.

    Pls share complete flow.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @Hardesh15 

    This is what I currently have done but it doesn't work.

    anonymous21_4-1660110786697.png

    anonymous21_6-1660110850943.pnganonymous21_7-1660110868157.png

    anonymous21_9-1660110908433.png

    I don't know how to calculate for those columns based on the leave type because previously I use a switch so it will need to fill in 2 columns only for the calculations.

     

    This is my previous calculation in another flow.

    anonymous21_10-1660110948363.png

     

    sub(items('Apply_to_each')?['EmergencyLeave'], triggerOutputs()?['body/Total_x0020_Days_x0020_Applied']) 
    add(triggerOutputs()?['body/Total_x0020_Days_x0020_Applied'],items('Apply_to_each')?['EmergencyLeaveUsed'])

     

    How to fill in the formula for all columns (the leave type) but it will only update based on the leave type modified/created by the user in the first place?

     

     

     

     

     

     

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @syhrh  Use filter query in Get items from leave types for Leave types. When someone apply for leave, you will have leave types. Use this from trigger to get items for leave types filter and the same in Leave balance.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 307 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 269 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 115 Super User 2026 Season 1

Last 30 days Overall leaderboard