Forum Discussion
Working Days
- 2 years ago
Try this calculated column in your Date table. It requires a 1:* relationship between Date and bank-holidays.
Working Days = NOT WEEKDAY ( 'Date'[Date] ) IN { 1, 7 } && ISBLANK ( COUNTROWS ( RELATEDTABLE( 'bank-holidays' ) ) ) - 2 years ago
The two expressions are evaluated independently. The first one works as described (check if Date is a weekend). The second one checks if the date in the current row of the Date table exists in bank-holidays table; if it doesn't, then it's considered a working day (assuming it's not a weekend). The assumption is that bank-holidays contains only holidays. Hope that helps.
Try this calculated column in your Date table. It requires a 1:* relationship between Date and bank-holidays.
Working Days =
NOT WEEKDAY ( 'Date'[Date] ) IN { 1, 7 } && ISBLANK ( COUNTROWS ( RELATEDTABLE( 'bank-holidays' ) ) )
- ArchStanton2 years agoPower Participant
That works perfectly - thank you!
- ArchStanton2 years agoPower Participant
Can you briefly explain how this works please?
My understanding is that NOT produces a list of FALSE values if the Date is a Weekend (not a work day), then this list is used as Lookup to the Bank Hoilday table where all NONBLANKS (public holidays) are also counted as FALSE - the 2 are then combined.
Is that correct - does it make sense?
- DataInsights2 years agoSuper User
The two expressions are evaluated independently. The first one works as described (check if Date is a weekend). The second one checks if the date in the current row of the Date table exists in bank-holidays table; if it doesn't, then it's considered a working day (assuming it's not a weekend). The assumption is that bank-holidays contains only holidays. Hope that helps.
- ArchStanton2 years agoPower Participant
yes thank you, much appreciated!