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 / Displaying and calcula...
Power Apps
Answered

Displaying and calculating negative time

(0) ShareShare
ReportReport
Posted on by 87
Hi,
 
I am developing a time sheet app and having problem managing a time balance.
 
I have one list called ‘staff profile’ and another one to record staff shifts.
 
When a user records a shift, I retrieve the current ‘Time Balance’ from a column called ‘Time Balance’.
 
I then add any positive or negative time to that balance. 
 
The column ‘Time Balance’ column is a number column and reflects a balance of time in minutes.
 
However, if a staff member has performed less ours than their rostered shift (booked off early) this produces a negative time. 
 
Problem 1#
 
I can only display this negative time in minutes. If I try and convert to hh:mm format, if the time to be deducted from the balance is under one hour (for example 00:30, this does not appear as -00:30.
 
Problem 2#
 
I can patch the time balance column ok just by using minutes. However, when I try and convert this back to hh:mm to display in app it is wrong if negative value… 
 
for example: 
 
‘Time Balance’ column: -64 
 
displayed in app as: -1 hr 56 mins
 
heres the code:
 
"Time Balance: " & With(
    {
        _value: LookUp(
            'Staff Profile',
            Employee.Email = User().Email
        ).'Time Balance',
        _num60: 60
    },
    Concatenate(
        Text(
            RoundDown(
                (_value / _num60),
                0
            )
        ),
        " hours ",
        Text(
            Mod(
                _value,
                _num60
            )
        ),
        " minutes "
    )
)
 
 
Any help or suggestions appreciated. Perhaps a better way?!
 
 
 
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,559 Most Valuable Professional on at
    Hi gmbeee
    Something like this should do it
    "Time Balance: " & 
       With(
       {
          _value: 
          LookUp(
             'Staff Profile',
             Employee.Email = User().Email
          ).'Time Balance'
       },
       If(
          _value < 0,
          "-"
       ) & 
       Text(
          RoundDown(
             Abs(_value) / 60,
             0
          )
       ) & " hours " & 
       Text(
          Mod(
             Abs(_value),
             60
          )
       ) & " minutes "
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • gmbeee Profile Picture
    87 on at
    Thank you @WarrenBelz
     
    That works perfectly!!! Just had to add the LookUp inside Value()

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 387

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 301

Last 30 days Overall leaderboard