cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SandraAkujobi
Post Partisan
Post Partisan

How to calculate daily/weekly working hours

How can I calculate the total hours worked in day excluding travel time and vice versa for each users. I would also need to do the same for a week as well so weekly time excluding travel and vice versa. so any entries put in for the day/week from each employee would  be calculated and stored on the daily/weekly pages as well as in the SharePoint list. On SharePoint would those calculated time be added repetitively too all the rows related to that day?

 

3 REPLIES 3
VijayTailor
Resident Rockstar
Resident Rockstar

Hi Sandra,

For Hours calculation for you do like that.

VijayTailor_0-1601022717237.png

 


Consider  -  DataWithOutLeave as Data Source and HrsMonday as Column/FieldName

If(
  Len(Text(RoundDown(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday))/60,0)))=1,
  Concatenate(
            "0",
            Text(RoundDown(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday))/60,0)),
            ".",
            If(Len(Text(Mod(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday)),60)))=1,Concatenate("0",Text(Mod(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday)),60))),Text(Mod(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday)),60)))
  ),
  Concatenate(
             Text(RoundDown(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday))/60,0)),
             ".",
             If(Len(Text(Mod(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday)),60)))=1,Concatenate("0",Text(Mod(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday)),60))),Text(Mod(Sum(60*Sum(DataWithOutLeave,HrsMonday),Sum(DataWithOutLeave,MntMonday)),60)))
  )
)

Hope this will help you to resolve your issue.

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Please vote for my idea if you feel, that will help you in the future or good to have in power app.
https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Ability-s-to-Select-Icon-from-UIFabric/idi-p/69...

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Preview-Mode-for-All-the-Device-Like-Phone-Tabl...





I don't quite get this, is this for daily calculation  or weekly calculation and also is HrsMonday  a column where the calculated time will be stored? Also what field does MntMonday represent? 

Basically For Calculate the Hours we the Hrs Part and Mnt Part.

So for that, i created a collection and AddCoumns Like below. (Why i using Split - Answer is Coz how Value is like Date-1.5 formate)

 "HrsMonday",
            First(
                Split(
                    Text(
                        Text(
                            If(
                                "." in Text(
                                    Last(
                                        Split(
                                            Mon,
                                            "-"
                                        )
                                    ).Result
                                ),
                                Last(
                                    Split(
                                        Mon,
                                        "-"
                                    )
                                ).Result,
                                Concatenate(
                                    Last(
                                        Split(
                                            Mon,
                                            "-"
                                        )
                                    ).Result,
                                    ".00"
                                )
                            )
                        )
                    ),
                    "."
                )
            ).Result,
            "MntMonday",
            Last(
                Split(
                    Text(
                        Text(
                            If(
                                "." in Text(
                                    Last(
                                        Split(
                                            Mon,
                                            "-"
                                        )
                                    ).Result
                                ),
                                Last(
                                    Split(
                                        Mon,
                                        "-"
                                    )
                                ).Result,
                                Concatenate(
                                    Last(
                                        Split(
                                            Mon,
                                            "-"
                                        )
                                    ).Result,
                                    ".00"
                                )
                            )
                        )
                    ),
                    "."
                )
            ).Result,

  
you can use this code to Addcolums like that and use it for calculation.

Hope this will help you to resolve your issue.

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Please vote for my idea if you feel, that will help you in the future or good to have in power app.
https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Ability-s-to-Select-Icon-from-UIFabric/idi-p/69...

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Preview-Mode-for-All-the-Device-Like-Phone-Tabl...



Helpful resources

Announcements
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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (28,115)