Forum Discussion

Rich_Wyeth's avatar
Rich_Wyeth
Helper I
6 months ago
Solved

Negative difference in Days

HI,   I have the below to calculate Network days between two dates. However if it is a negative, it isn't returning the value of that, it just says ERROR. I can't figure out why, have I missed anyt...
  • MFelix's avatar
    6 months ago

    Hi Rich_Wyeth ,

     

     

    Try the following code:

    try List.Count(List.Select(List.Dates([KPI_DATE], Duration.TotalDays([REC_DATE]-[KPI_DATE]) + 1, #duration(1,0,0,0)), each List.Contains({1,2,3,4,5}, Date.DayOfWeek(_))))
    otherwise
    
    - List.Count(List.Select(List.Dates([KPI_DATE], Duration.TotalDays([KPI_DATE]-[REC_DATE]) -1, #duration(1,0,0,0)), each List.Contains({1,2,3,4,5}, Date.DayOfWeek(_))))