Forum Discussion
DAX working days current month
Hi
I need a DAX function to work out the working days for the current month.
For example February 2021 = 20 working days. Next month March 2021 = 23 working days and April 2022 =20
In addition to this , I also require a DAX function to calculate how many working days have passed as of Today
For example Feb 2022 there are 20 working days and as of today 14 workign days have passed.
Just to let you know I have a dates table and this table contains a column called 'is working day' with a 1 for working day and 0 for weekend
thank you
Richard
Richard
cottrera , try measures like
Working days passed = CALCULATE(SUM('Date'[is Working day]),DATESMTD('Date'[Date]))
this month = CALCULATE(SUM('Date'[is Working day]),DATESMTD(ENDOFMONTH('Date'[Date])))
4 Replies
- amitchandak
Super User
cottrera , try measures like
Working days passed = CALCULATE(SUM('Date'[is Working day]),DATESMTD('Date'[Date]))
this month = CALCULATE(SUM('Date'[is Working day]),DATESMTD(ENDOFMONTH('Date'[Date]))) - cottrera
Post Prodigy
Hi Amitchandak
thank you for your quick response. I have tried both measure , however they both give the same result
regards
Richard
- amitchandak
Super User
cottrera , Try like
MTD=
var _min = eomonth(today(),-1)+1
var _max = today()
return
CALCULATE(SUM('Date'[is Working day]), FILTER(ALL('Date'),'Date'[Date] >= _min && 'Date'[Date] <=_max ) )or
Working days passed = CALCULATE(SUM('Date'[is Working day]),DATESMTD('Date'[Date]), 'Date'[Date] <=today() )
- cottrera
Post Prodigy
Perfect , works great thank you😀