Forum Discussion
Working Days between two periods
- 6 years ago
Yes, like I mentioned - you have to add your workday-filter.
It should work like you did before.
As I had to build the sample data from scratch, I've allowed myself to skip that additional column.
- Anonymous6 years ago
Thank you Imke!! Here is the final formula for anyone else that may need this. Again, this counts the number of workdays between one period and the next (in this...between Due Dates and Ship Dates). And also accounts for if the ship date comes earlier than the due date.
WDC =If( 'Flu Shipped'[Due Date] < 'Flu Shipped'[Date Shipped],CALCULATE(COUNTROWS( DateTable ),DATESBETWEEN ( DateTable[Date], 'Flu Shipped'[Due Date], 'Flu Shipped'[Date Shipped]),DateTable[DateIsWorkingDay]= True,ALL ( 'Flu Shipped' )),CALCULATE(COUNTROWS( DateTable ),DATESBETWEEN ( DateTable[Date], 'Flu Shipped'[Date Shipped], 'Flu Shipped'[Due Date]), DateTable[DateIsWorkingDay]=True,ALL ( 'Flu Shipped' )) * -1)
Hi working for me, but there might be typos in my post. Please compare with screenshot:
WDC =
If( 'Flu Shipped'[Due Date] < 'Flu Shipped'[Date Shipped],
CALCULATE(
COUNTROWS( 'Calendar' ),
DATESBETWEEN ( Calendar[Date], 'Flu Shipped'[Due Date], 'Flu Shipped'[Date Shipped]),
ALL ( 'Flu Shipped' )
),
CALCULATE(
COUNTROWS( 'Calendar' ),
DATESBETWEEN ( Calendar[Date], 'Flu Shipped'[Date Shipped], 'Flu Shipped'[Due Date]) ,
ALL ( 'Flu Shipped' )
) * -1)
.. just be aware that the holiday-filter is missing in my sample..
Hi Imke - Your formula seems to be counting total days. I am just looking for week days. For example, to use your numbers below there are not 32 "work days" between January 1 and Feb 1.
- ImkeF6 years ago
Community Champion
Yes, like I mentioned - you have to add your workday-filter.
It should work like you did before.
As I had to build the sample data from scratch, I've allowed myself to skip that additional column.
- Anonymous6 years agoNot applicable
Thank you Imke!! Here is the final formula for anyone else that may need this. Again, this counts the number of workdays between one period and the next (in this...between Due Dates and Ship Dates). And also accounts for if the ship date comes earlier than the due date.
WDC =If( 'Flu Shipped'[Due Date] < 'Flu Shipped'[Date Shipped],CALCULATE(COUNTROWS( DateTable ),DATESBETWEEN ( DateTable[Date], 'Flu Shipped'[Due Date], 'Flu Shipped'[Date Shipped]),DateTable[DateIsWorkingDay]= True,ALL ( 'Flu Shipped' )),CALCULATE(COUNTROWS( DateTable ),DATESBETWEEN ( DateTable[Date], 'Flu Shipped'[Date Shipped], 'Flu Shipped'[Due Date]), DateTable[DateIsWorkingDay]=True,ALL ( 'Flu Shipped' )) * -1)