Forum Discussion
Calculate total working dates
Hi.
I have a tabel "Start Stop" where i have start and end dates for each employee. Same employee can start and stop more times.
I have a date tabel and a employee tabel with relations.
I want to calculate the total working days for a month and want to calculate the working days under considiration of start and end date and a slicser, where i filter on dates.
Can anyone help?
3 Replies
- amitchandak
Super User
Moller70 ,
Tray a measure like
Working days
var _max = maxx(allselected(Date), Date[Date])
var _min = Minx(allselected(Date), Date[Date])
return
NETWORKDAYS(max(_min ,[Start Date]), Max(_max, [Stop Date]),1)
Business day with and without using DAX Function NETWORKDAYS: https://www.youtube.com/watch?v=Qs03ZZXXE_c
- Moller70Frequent Visitor
Hi and thank you for your reply.
I have made this formula:XYC working days 2 =var _max = maxx(Kalender,Kalender[Date])var _min = minx(Kalender,Kalender[Date])returnNETWORKDAYS(max(_min,'XYC Employee Start Stop'[Start Date]),max(_max,'XYC Employee Start Stop'[Stop Date]),1)But it is writing the error message: "A single value for column 'Start Date' in tabel 'XYC Employee Start Stop' cannot be determined.If I make a simpel If statment, I cannot sellect the 'XYC Employee Start Stop'[Start Date]. Why that?I only want the measure to calculate the number of working days for the employees that acutally is employed in the periode.So I need somthing like this:If(And(XYC Employee Start Stop'[Start Date])<= STARTOFMONTH(Kalender[Date]),'XYC Employee Start Stop'[Start Date])>= STARTOFMONTH(Kalender[Date])),
- AnonymousNot applicable
Working_Days= var max = Maxx(Allselected(Date), Date[Date])
var min = Minx(allselected(Date), Date[Date])
return
Networkdays(max(min ,[Start Date]), Max(max, [End Date]),1)