2 Replies Latest reply on Feb 14, 2018 9:56 AM by Rama Potla

    number of days issue when year changes

    Rama Potla

      Hi Tableau Team,

      I have one requirement that  need to calculate number of days for development by excluding weekends.

      I was able to create calculation for that and working fine.

      DATEDIFF("weekday", [Start date], [Start date - End date])
      - 2 * (DATEPART('week', [Start date - End date]) -
      DATEPART('week', [Start date]))

      +

      (IF DATENAME('weekday',[Start date - End date]) = 'Saturday' OR
      DATENAME('weekday',[Start date]) = 'Sunday'
      THEN 0 ELSE 1 END)

      above formula will give number of days for development.

      when year changes number of days for development not showing correctly

      for example if we have  request start date(27/12/2017) and end date(01/02/2018) then showing 109 days

      Can anybody suggest some solution for this to get  correct days