Forum Discussion
Gopinath_iyer
Helper II
4 years agocalculate weekdays basis user selection
Hi All, I want to calculate weekdays (mon to fri) basis user selection. I have a date column which will used in slicer and basis the date range user selects in slicer i want to calculate the ...
johnt75
Super User
4 years agoAdd an "Is working day" column to your date table, which returns 1 if it is Mon-Fri, otherwise 0. Then you should be able to do something like
Num days worked =
VAR startDate =
MIN ( 'Slicer Date'[Date] )
VAR endDate =
MAX ( 'Slicer Date'[Date] )
RETURN
CALCULATE (
SUM ( 'Date'[Is working day] ),
DATESBETWEEN ( 'Date'[Date], startDate, endDate ),
TREATAS ( VALUES ( 'Timesheets'[Date] ), 'Date'[Date] )
)
- Gopinath_iyer4 years ago
Helper II
Hi
I created a date table using calanderauto() functions and used the above suggestion and result i am getting is 260, but i want the weekdays between the dates selected in the slicer
- johnt754 years ago
Super User
Are you using the same column on your date slicer as you have in the code where I put 'Slicer Date'[Date] ?