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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,402)