Format calculation for easy audit

mizzmeeshelly

New Member
Joined
Aug 1, 2018
Messages
5
Hi all,

I'm new to Power BI and hoping all the masters out there can help me figure out to set this up. My data contains the following:

**The result I want to see is an easy way to audit for any one who does not have a BREAK added to their schedule for every 3.5hrs that they work. It's hard to audit for these because the employees do not have a consistent 8hrs work schedule.

This is the example of data source:
DateStartDateTimeEndDateTimeWorkedHoursProviderNameWorkCode
10/26/202010/26/2020 16:5010/26/2020 17:501AMYAdmin
10/26/202010/26/2020 16:4010/26/2020 16:500.17AMYBREAKS
10/26/202010/26/2020 15:4010/26/2020 16:401AMYAdmin
10/26/202010/26/2020 14:4010/26/2020 15:401AMYAdmin
10/26/202010/26/2020 14:1010/26/2020 14:400.5AMYAdmin
10/26/202010/26/2020 13:4010/26/2020 14:100.5AMYAdmin
10/26/202010/26/2020 13:0010/26/2020 13:300.5AMYLUNCH
10/26/202010/26/2020 12:3010/26/2020 12:400.17AMYBREAKS
10/26/202010/26/2020 11:3010/26/2020 12:301AMYAdmin
10/26/202010/26/2020 10:3010/26/2020 11:301AMYAdmin
10/26/202010/26/2020 9:3010/26/2020 10:301AMYAdmin
10/26/202010/26/2020 9:0010/26/2020 9:300.5AMYAdmin
11/8/202011/8/2020 6:4511/8/2020 7:451CARLAdmin
11/7/202011/7/2020 18:0011/7/2020 18:150.25STACYAdmin
11/7/202011/7/2020 13:4011/7/2020 14:100.5ANNAdmin
11/7/202011/7/2020 13:1011/7/2020 13:400.5ANNAdmin
11/7/202011/7/2020 13:1011/7/2020 14:101BARBARAAdmin
11/7/202011/7/2020 12:4011/7/2020 13:100.5BARBARAAdmin
11/7/202011/7/2020 12:1011/7/2020 12:400.5BARBARAAdmin
11/7/202011/7/2020 12:0011/7/2020 12:100.17BARBARABREAKS
11/7/202011/7/2020 11:4011/7/2020 12:401ANNAdmin
11/7/202011/7/2020 11:3011/7/2020 11:400.17ANNBREAKS
11/7/202011/7/2020 11:0011/7/2020 12:001BARBARAAdmin
11/7/202011/7/2020 10:3011/7/2020 11:301ANNAdmin
11/7/202011/7/2020 10:0011/7/2020 11:001BARBARAAdmin
11/7/202011/7/2020 9:3011/7/2020 10:301ANNAdmin
11/7/202011/7/2020 9:0011/7/2020 10:001BARBARAAdmin


This is the output I organize on Power BI:

1605747359472.png


Is there any way for me to format so I could audit for BREAK codes easier?

We want to make sure all the employees have 1 BREAK for every 3.5hrs and 2 BREAKs for every 7 hours worked.

Thank you.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Do you need to calculate how many break hours they had in a workday or just that they had 2 breaks?
Do break hours count toward working hours? Lunch hours?

Assuming you have the dates as columns and ProviderName as rows so we don't have to get fancy on the measures...

[Sum of Worked Hours] := SUM(Source[WorkedHours]) // Counts the break hours too
Otherwise
[Sum of Worked Hours] := CALCULATE ( SUM(Source[WorkedHours]), Source[WorkCode] <> "BREAKS")
[Number of Breaks] := CALCULATE ( COUNTROWS(Source[ProviderName]), Source[WorkCode] = "BREAKS")
VBA Code:
[Took All Breaks] :=
IF ( ISBLANK([Sum of Worked Hours]), BLANK(),
IF (
    [Sum of Worked Hours] <= 3.5
        && [Number of Breaks] = 1,
    BLANK (),
    IF (
        [Sum of Worked Hours] <= 7
            && [Number of Breaks] = 2,
        BLANK (),
        "Break Error"
    )
)
)
If you use the [Took All Breaks] measure this should highlight who didn't take the appropriate number of breaks - blank if they're OK, or "Blank Error" if they had a problem on that date. You can adjust the logic if someone is allowed more than one break each 3.5 hours.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top