Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
wailey1
Frequent Visitor

Hourly breakdown of staff including breaks

Hi

I need to breakdown the start and finish times of our staff into hours so i can compare hourly sales vs hourly staff costs.  I have got to a point where i have the hour breakdown from the signing in and signing out times, but cant work out how to add the breaks (there are up to  4 a day for some lucky staff)  I think the original formula i have used is very long winded and can probably be simplified as well, but as a novice i went with what i could do!!

Formula used is;

HourBreakdown = IF('CHAMPS LABOUR ACTUALS 23'[SignedInTime]=0,0,IF('CHAMPS LABOUR ACTUALS 23'[SignedInTime]>'Champs Labour Actuals 23'[Hours],0,IF('Champs Labour Actuals 23'[SignedOutTime]>'Champs Labour Actuals 23'[Hours],IF(('Champs Labour Actuals 23'[Hours]-'CHAMPS LABOUR ACTUALS 23'[SignedInTime])>1/24,1/24,'Champs Labour Actuals 23'[Hours]-'CHAMPS LABOUR ACTUALS 23'[SignedInTime]),IF('Champs Labour Actuals 23'[SignedOutTime]>'CHAMPS LABOUR ACTUALS 23'[Hours],'Champs Labour Actuals 23'[SignedOutTime]-'CHAMPS LABOUR ACTUALS 23'[Hours],0))))*60*24
From this data;
wailey1_0-1701081564415.png

The break data looks like this;

wailey1_2-1701081674624.png

 

Would ideally like to have just the one column with all the information calculated.
Any ideas please?
Thanks

 

 

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @wailey1 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1701244832984.png

vtangjiemsft_1-1701244845199.png

(2) We can create calculated columns.

breakhour = HOUR([Break1Length]+[Break2Length]+[Break3Length]+[Break4Length])
workhour- breakhour = 
var _work = HOUR([SignedOutTime]-[SignedInTime])
var _break=CALCULATE(SUM('Table (2)'[breakhour]),FILTER('Table (2)',[id]=EARLIER('Table'[id])))
return _work-_break

(3) Then the result is as follows.

vtangjiemsft_2-1701244890855.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

hi

Thanks for your response but that wasnt what i was after.  I have done a pbix of my raw data, but i cant work out how to attach it to this reply!!  Apologies for my ignorance, but can you show me how, then i can explain what i need.

Thanks

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors