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 Apps / How to set leave days ...
Power Apps
Answered

How to set leave days to a year

(0) ShareShare
ReportReport
Posted on by 122

Hello

I'm finishing building a leave request application using PowerApps for Teams. Here, the users from a Office365Users work group can make their requests and a manager can review and approve or reject them.

 

I have one table (REQUESTS) that records all the requests, and other (USERS_DATA) that keeps record of each user and how much leave time he has left ([remaining_time]). The approved requests subtract to the remaining_time field.

 

The USERS_DATA table also has a field that records the current year: what I need to do now is to set the unused leave time when the year ends, reset the inicial leave time when a new year starts, and add any excedent time from the year prior (for example, if the user has 20 leave days at the start of 2021 and by the end of the year still has 2 days left, at the beginning of 2022 he should have 22 days total [2 from 2021 and 20 from 2022]).

 

Any idea how to do this? Thank you.

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @PedroFernandes 

    There are probably a few ways to do this but I'd probably:

     

    1. Create a helper column, call it YearEnd_UnUsed_Leave (or similar)

    2. Run a scheduled Flow on 1-Jan each year that gets the value from [remaining_time] and adds it to YearEnd_UnUsed_Leave

    3. Then, depending on what your current process is to assign 20 days at the start of the year, adjust this process to include the value YearEnd_UnUsed_Leave

     

    Just one idea.

  • PedroFernandes Profile Picture
    122 on at

    Thank you, I'll try to implement it as soon as I can. I'll let you know if it worked.

  • PedroFernandes Profile Picture
    122 on at

    The flow creation seems to be pretty straightforward, actually. But the scheduled flow only let me repeat it monthly at max, and for this to work I would need it to repeat yearly (meaning the flow that checks for unused leave time and adds it to total time would only occur on January 1st each year).

    I'll try to find a workaround for that.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    What you can do is get the Day and Month of Today()’s date as Strings. Then check if both are 1. If they are, run the flow, otherwise do nothing 

  • PedroFernandes Profile Picture
    122 on at

    Sorry asking this since some time has passed after this post, but I'm currently stuck:
    I followed your solution and tried to add a scheduled  flow, using Recurrence as a trigger, and as the next step Update a Row (Dataverse). Here I already selected the table name and added the row ID. But I don't know how to input the values I need. How do I add the value from [remaining_time] to YearEnd_UnUsed_Leave? And (maybe in a second flow), at the beggining of a new year how can I set an inicial value to [remaining_time], consisting on a set number plus the YearEnd_UnUsed_Leave from the previous year.

    Thank you

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @PedroFernandes 

    I don't use DataVerse with Flow, I use SharePoint but I assume it's the same/similar?

     

    You'll only need 1 Flow:

    - Trigger can be Recurrence

    - First, Get Items from your Table, you can set your Top Count here to a value eg 1000 or leave as Default which should be 'all'

    - Then, Apply to Each, choose 'value' from your 'Get Items'

    - Then, inside your 'Apply to Each',

       --  use action Update Item, Note Choose ID from the Get Items

       -- select your Table

       -- then set YearEnd_UnUsed_Leave to [remaining_time]

     

    You would then need to have a field that holds a persons Yearly Leave entitlement ... or ... if everyone gets the same amount then just use that number, say 20? Call this Yearly_Leave (or similar)

     

    The next action would then be to Update Item again [inside your 'Apply to Each'] where you set [remaining_time] to YearEnd_UnUsed_Leave + Yearly_Leave.

     

    I'd suggest setting up a test table and flow just to make sure you know how this all works before you run it on your actual data because I don't know your data's state and I'd hate for you to have to recreate a dataset 🙂

  • PedroFernandes Profile Picture
    122 on at

    That's very helpful!

    I've been able to follow your steps, adapting them to Dataverse, until the last one: when I have to update the [remaining_time] row with the (YearEnd_UnUsed_Leave + Yearly_Leave) value, where to I put them?

    My flow currently looks like this (some names were translated):

    Sem Título.png

     

    I really can't see where else should I add those fields, or how to make the sum in a flow. I also tried to use an expression, to no avail...

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @PedroFernandes 

    Power Automate has an add() function that you can use here. Check this video from Flow Joe for how it's used. Basically its

     

    // this is pseudo code, you will need to use Dynamic Content options here
    add( [remaining_time], [Yearly_Leave])

     

    You may also need to consider using the float() function as well? This Flow Joe video explains how. Something like this:

     

    // this is pseudo code, you will need to use Dynamic Content options here
    add( float([remaining_time]), float([Yearly_Leave]))

     

    Hope that helps?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard