Forum Discussion

Moller70's avatar
Moller70
Frequent Visitor
3 years ago

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

    • Moller70's avatar
      Moller70
      Frequent 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])
      return
      NETWORKDAYS(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])),
       
  • Anonymous's avatar
    Anonymous
    Not 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)