Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Calculating The Time In Lieu In Power App

(1) ShareShare
ReportReport
Posted on by 8

Hi Folks,

 

I am developing a power app for time in lieu request. The way it worked it user first make a request by providing start and end date time and other fields. Then flow run and request send to user's Manager for approval. After approval , a dedicated leave balance  added to user record i.e. HH:MM. When user make a another request to take time in lieu, balance will be deducted from user leave balance. This is the working of entire app in short.

 

There is one requirement when user do after hours work i.e. between 11pm to before 6 am , time will be double. For example if user work from 15/07/2024 10:00 PM till 16/07/2024 01:10 AM, then total time he worked 5:20 (HH:MM) (10 PM TO 11 PM = 1 Hour, 11PM to 01:10 AM = 4:20). Thats all i have calculated in Power app On select event of Submit Button. 

 

Now i have below requirements and need input:

STartDateTime: 

End DateTime

1. what if user works on Weekend. Or start from 11 PM Friday till 9 am Saturday. What would be the best approach to figure out  when to add double hours or not on Weekend.

2. Right now, its hard code in my app if user work after 11 pm and before 6 am, i am doubling the time. What if requirement change they want from 10 pm to 3 am. I need to change the app code again.

 

I am looking for some generic solution's where either i create a another list for this rule or something.

 

 

  • developingteal Profile Picture
    392 on at
    Calculating The Time In Lieu In Power App
    What's the status of this/ what's the current error?
  • developingteal Profile Picture
    392 on at
    Re: Calculating The Time In Lieu In Power App

    Where do you want to store this information? You can definitely handle the requirements you have inside of powerapps. You can create conditionals for all the conditions you specified, and set the 'hard coded' version you made to variables in a different place that way it makes it easier to edit. You can't really get around changing the code or some form of it if the requirements change, you can just follow good coding principles by assigning values to variables to make them easier to edit, hence in your scenario when the values change you can just change it in one place rather than everywhere.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard