cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
straiderox2
Helper I
Helper I

Sum hour or another ideia :)

Hello friends, how are you?

I need help.

I need to count the time of an activity, the person must start and stop the activity, and he can resume when necessary. I put a timer and a start button, and a stop button.
I set it up every time the stop button is pressed it saves to a collection.
I need to add all the times of the collection to a label but I can't, attached the code I made is attached.
If anyone has another idea to do what I need, I accept suggestions 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @straiderox2 ,

Do you want to sum the time value in your collection table?

 

Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

8.JPG

 

7.JPG

Set the Text property of the Label to following:

Text(
   Time(
        0,
        0,
        Sum(Gallery1.AllItems, Value(First(Split(Value, ":")).Result)*3600 + Value(Last(FirstN(Split(Value, ":"),2)).Result)*60 +  Value(Last(Split(Value, ":")).Result))
   ),
   "[$-en-US]hh:mm:ss"
)

 

On your side, you should try the following formula:

Text(
   Time(
        0;
        0;
        Sum(Gallery1.AllItems; Value(First(Split(Tempos_Salvos; ":")).Result)*3600 + Value(Last(FirstN(Split(Tempos_Salvos; ":");2)).Result)*60 +  Value(Last(Split(Tempos_Salvos; ":")).Result))
   );
   "[$-pt-BR]hh:mm:ss"
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3

so I would capture the number of minutes on each activity using DateDiff, then sum that value for the collection

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

 

calculating it across all records in other methods is likely too complex in other ways.

 

also, if your data source is Common Data Service (CDS) you can create a calculated field using the diffinminutes formula for this calculation.

v-xida-msft
Community Support
Community Support

Hi @straiderox2 ,

Do you want to sum the time value in your collection table?

 

Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

8.JPG

 

7.JPG

Set the Text property of the Label to following:

Text(
   Time(
        0,
        0,
        Sum(Gallery1.AllItems, Value(First(Split(Value, ":")).Result)*3600 + Value(Last(FirstN(Split(Value, ":"),2)).Result)*60 +  Value(Last(Split(Value, ":")).Result))
   ),
   "[$-en-US]hh:mm:ss"
)

 

On your side, you should try the following formula:

Text(
   Time(
        0;
        0;
        Sum(Gallery1.AllItems; Value(First(Split(Tempos_Salvos; ":")).Result)*3600 + Value(Last(FirstN(Split(Tempos_Salvos; ":");2)).Result)*60 +  Value(Last(Split(Tempos_Salvos; ":")).Result))
   );
   "[$-pt-BR]hh:mm:ss"
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanksss friends

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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