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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
DonnaDonut85
Frequent Visitor

Help with displaying overtime during week and weekend separately on a table

Hi all, 

 

Hoping someone can help. We have a requirement for timesheets / payroll and need visibility of weekly hours and overtime. 

We have a Start and End Time and contracted hours coming from data source, i am almost there but i cannot figure out the last part of splitting the overtime hours (which i have working) into Mon-Fri column and a Sat-Sun column. 

 

All my below calculations work fine but i need to show if any of the days fall on a Sat-Sun and include that in the table

 

Calculated column for Total time worked - DATEDIFF(TimeSheets[ActualStart],TimeSheets[ActualEnd],MINUTE)

Calculated column for Total time excluding breaks - IF(TimeSheets[TotalTimeWorkedinMins] >=361,TimeSheets[TotalTimeWorkedinMins]-30,TimeSheets[TotalTimeWorkedinMins])

 

Calculated Column for Total Time in Hours - DIVIDE(TimeSheets[TotalTimeExcBreaks],60,0)

 

Measure to show if conducted overtime or just basic hours - IF(SUM(TimeSheets[TotalTimeHours]) > MAX(TimeSheets[ContractedHours]),"OT","Basic")

 

Measure for over time hours - sum(TimeSheets[TotalTimeHours]) - max(TimeSheets[ContractedHours])

 

DonnaDonut85_1-1645194742822.png

 

This is the table i currently have and the layout is what the user would like to see. But they would like to also include a Mon-Fri column and Sat-Sun column instead of the OverTimeHours column. So if the start dates are all during the week it would show under Mon-Fri column, if any start dates worked on the weekend it would show under the Sat-Sun column. 

 

I have tried 

 

Mon-Fri(f)_ = IF(ISBLANK(TimeSheets[ActualStart]),
BLANK(),
IF(TimeSheets[IsActualStartWeekday]=1, 0,
IF(TimeSheets[IsActualStartWeekday]=7, 0,
CALCULATE(SUM([OverTimeHours]))))
 
Which wont work because the OverTimeHours is a measure. I have tried a few variations but not having much luck- hoping someone can help! 
 
Thanks
2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @DonnaDonut85 ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we could close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yalanwu-msft
Community Support
Community Support

Hi, @DonnaDonut85 ;

Try it.

Mon-Fri(f)_ =
IF (
    ISBLANK ( TimeSheets[ActualStart] ),
    BLANK (),
    IF (
        TimeSheets[IsActualStartWeekday] IN { 1, 2, 3, 4, 5 },
        "Mon-Fri",
        "Sat-Sun"
    )
)

If I don't understand correctly, can you share a simple example or scenario and sample output will be better understood?

Or a sample pbix after removing sensitive data.

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 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.

October NL Carousel

Fabric Community Update - October 2024

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