Count of Days Not Worked

SimonNU

Board Regular
Joined
Jul 11, 2013
Messages
140
I'm attempting to count the days not worked. Any suggestions?

Fact Table:
Date_Key | Employee Name | Date Hired | Date Terminated | Hours

Date Table:
Date_Key | Date | WeekendOrWeekday | IsHoliday

So far I have the below working but unfortunately it's counting days before the employee was hired and after they were terminated. How can I filter it to just the context between the Employee's Date Hired and Date Terminated?

Code:
Count of Non-Holiday Weekdays Not Worked :=CALCULATE (
    COUNTX (
        VALUES ( 'Date Table'[Date] ),
        IF ( [Sum of Hours] = 0, 1 )
    ),
    'Date Table'[IsHoliday] = FALSE (),
    'Date Table'[WeekendOrWeekday] = "Weekday"
)


Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
See if this gives any good ideas. Two methods to calculate Person-Hours | Power Pivot | Tiny Lizard

  • Your fact table is a bit weird to me... what does the first column represent?
  • Your COUNTX + VALUES is clever! Since [Date] is the primary key, I suspect the VALUES isnt' needed -- but love the creativity here.
  • The easy way... is probably [Total Work Days] - [Days Actually Worked] sorta thing...
  • Total Work Days := CALCULATE(COUNTROWS('Date Table'), 'Date Table'[IsHoliday] = FALSE, Date Table'[WeekendOrWeekday] = "Weekday")
  • Days Worked := DISTINCTCOUNT(Facts[Date_Key])

Might need a SUMX of the latter of employees?
 
Upvote 0
Thanks Scott!

I ended up going the third route you suggested, [Total Work Days] - [Days Actually Worked]. It felt like a bit of a hack but it works for my purposes.
 
Upvote 0

Forum statistics

Threads
1,224,115
Messages
6,176,466
Members
452,728
Latest member
mihael546

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