Forum Discussion
Work with hours
| i'd like sum the total of hours, day by day and make a table like this |
| start time | Final hour | total hh | |
| 02/01/2020 | 18:00:00 | 18:30:00 | 00:30:00 |
| 02/01/2020 | 17:00:00 | 18:00:00 | 01:00:00 |
| 02/01/2020 | 16:00:00 | 17:00:00 | 01:00:00 |
| 02/01/2020 | 15:00:00 | 16:00:00 | 01:00:00 |
| 02/01/2020 | 14:00:00 | 15:00:00 | 01:00:00 |
| 02/01/2020 | 13:00:00 | 14:00:00 | 01:00:00 |
| 02/01/2020 | 12:00:00 | 13:00:00 | 01:00:00 |
| 02/01/2020 | 11:00:00 | 12:00:00 | 01:00:00 |
| 02/01/2020 | 10:00:00 | 11:00:00 | 01:00:00 |
| 02/01/2020 | 09:00:00 | 10:00:00 | 01:00:00 |
| 02/01/2020 | 08:00:00 | 09:00:00 | 01:00:00 |
| 04/01/2020 | 11:00 | 11:35 | 00:35:00 |
| 04/01/2020 | 10:00 | 11:00 | 01:00:00 |
| 04/01/2020 | 09:00 | 10:00 | 01:00:00 |
| 04/01/2020 | 08:00 | 09:00 | 01:00:00 |
| 04/01/2020 | 07:30 | 08:00 | 00:30:00 |
To it I'm use
after this, a did I Have to create table like that
| Date | Hours Work total | Work by day | Extra Hour | |
| Thursday | 02/01/2020 | 10:30:00 | 08:00:00 | 02:30:00 |
| Saturday | 04/01/2020 | 04:05:00 | 04:00:00 | 00:05:00 |
I have to create a measure or Dax that identify the day, For exemple If de day is Saturday it gets the total hours and subtract per 04:00 hrs and to others day get total hours and subtract to 08:00 hrs . In the end I get the extra hour and plot a chart .
Estyfodense
Try the following formula: Make sure you do the right formatting of duration 13:30:55 (h:nn:ss)Total Hours = SUMX( hh, HH[Final hour ] - HH[start time] )Net Total Hours = [Total Hours] - IF( WEEKDAY(MAX(HH[Date]),1) = 7 ,TIME(8,0,0), TIME(4,0,0))Check Day, I
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon if you like this reply 🙂
To get the correct total, use this measure that references the solution @Fowmy
Total Net SUMX - SUMX(VALUES(HH[Date]), [Net Total Hours])
If this works for you, mark it as the solution. Praise is also appreciated. Please let me know if you don't.
Best regards
Pat
5 Replies
- Fowmy
Super User
Estyfodense
Try the following formula: Make sure you do the right formatting of duration 13:30:55 (h:nn:ss)Total Hours = SUMX( hh, HH[Final hour ] - HH[start time] )Net Total Hours = [Total Hours] - IF( WEEKDAY(MAX(HH[Date]),1) = 7 ,TIME(8,0,0), TIME(4,0,0))Check Day, I
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon if you like this reply 🙂
- Estyfodense
Helper I
This has already helped a lot, but the total hours does not correspond could help with this problem.
- mahoneypat
Microsoft Employee
To get the correct total, use this measure that references the solution @Fowmy
Total Net SUMX - SUMX(VALUES(HH[Date]), [Net Total Hours])
If this works for you, mark it as the solution. Praise is also appreciated. Please let me know if you don't.
Best regards
Pat
- Greg_Deckler
Community Champion
Estyfodense - This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907Also, these might help, a couple of quick measures I have created over the years that work with hours:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Hour-Breakdown/m-p/625085#M306