Forum Discussion
Networkdays
- 9 years ago
In this scenario, you need to have a full calendar date table, then add a column to tag if the date is working day.
IsWorkingDay = IF(WEEKDAY('Calendar'[Date],2)>5,0,1)Then you can create a calculated column like below:
NetWorkingDays = IF ( ISBLANK ( DateRange[StartDate] ) || ISBLANK ( DateRange[EndDate] ), 0, IF ( DateRange[StartDate] <= DateRange[EndDate], CALCULATE ( COUNT ( 'Calendar'[IsWorkingDay] ), DATESBETWEEN ( 'Calendar'[Date], DateRange[StartDate], DateRange[EndDate] ) ), - CALCULATE ( COUNT ( 'Calendar'[IsWorkingDay] ), DATESBETWEEN ( 'Calendar'[Date], DateRange[EndDate], DateRange[StartDate] ) ) ) )Regards,
thanks - i had this but im not sure if your formula - [which is cleverer than mine !] will return network days or calander days ?
APP 2 Posting = if(OR
('Data'[First Fully Approved Date]=0,'Data'[First Sourced Date]=0)
,0,
(DATEDIFF
('Data'[First Fully Approved Date].[Date],'Data'[First Sourced Date].[Date],DAY)
))
In this scenario, you need to have a full calendar date table, then add a column to tag if the date is working day.
IsWorkingDay = IF(WEEKDAY('Calendar'[Date],2)>5,0,1)
Then you can create a calculated column like below:
NetWorkingDays =
IF (
ISBLANK ( DateRange[StartDate] ) || ISBLANK ( DateRange[EndDate] ),
0,
IF (
DateRange[StartDate] <= DateRange[EndDate],
CALCULATE (
COUNT ( 'Calendar'[IsWorkingDay] ),
DATESBETWEEN ( 'Calendar'[Date], DateRange[StartDate], DateRange[EndDate] )
),
- CALCULATE (
COUNT ( 'Calendar'[IsWorkingDay] ),
DATESBETWEEN ( 'Calendar'[Date], DateRange[EndDate], DateRange[StartDate] )
)
)
)
Regards,
- praseejbk9 years ago
Advocate I
Hi
Thanks a lot for your formula, but there is a small issue I found that instead of using COUNT I used SUM now it is working fine:smileyhappy: