Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

for loop

Is it possible to do the calculation like in normal loop.

my condition is to calculate remaining holiday

employee will enter to total holiday i had in last year and this year and i have to calculate total available holiday and when he applies leave then total available holiday should be one day minus.




Total_available_holiday(TAH) = HLY+ HTY

leave = TAH - 1

 my doubt is if i use the above formula it will work correctly when he applies first leave, after that TAH remains same and leave will be calculated from that.


Please help me to calculate and update the values.

For(leave = 0; leave >=TAH;leave++)


current_Leave = TAH -1;

TAH = Current_leave;



Super User II
Super User II
Community Support
Community Support

Hi @PapithaSekar :

Do you want the value of TAH to be corresponding to -1 after executing "leave = TAH-1"?

I think this does not necessarily need to be implemented through a loop.The following code can directly achieve this requirement.


Ser(leave,TAH - 1);set(TAH,leave)


If you insist on using loops, I suggest you use the timer control.

I set the following Timer controls exactly according to your loop statement (if you need to adjust it, you can refer to the method I use)

Add a timer control:



1000/*loop in 1s(I am here just to make the presentation more clear, you can shorten the loop interval)*/








Set(current_Leave,TAH -1);Set(TAH,current_Leave);Set(leave,leave+1);






I assume ATH=10


Best Regards,



Thank you. I will try the first formula and update you. Timer control doesn't fit in my scenario. Am creating time registration app so employee will update if they take leave during working days. Daily they will registering time. Leave registration is one part of it. 


Hi @PapithaSekar :

Is your problem solved? Do you still need help?

If you have found a solution, could you mark it as a solution so that more people can see it.

Best Regards,


Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,971)