2 Replies Latest reply on Sep 14, 2016 3:07 PM by Saad Beedi

    Subtract business days from a user selected date

    Saad Beedi

      Hello,

       

      I am having a hard time implementing the below requirement. Was wondering if the Tableau Gurus out here could help!

       

      My requirement is to estimate or forecast a date by subtracting a fixed number of business days from the date entered by the user. The date entered by the user is my input(parameter) field and I already know the number of business days I want to subtract. Please advise

        • 1. Re: Subtract business days from a user selected date

          I'm sure there is a more elegant and complete solution, but here's a simple one to get you started.

          1. I created a Parameter called "order date parameter", which we have to cast as string since you want users to type in a value. Using Dates here only gives your users a static list of dates to select from, no option to type in.
          2. We then need to tell Tableau that the string is actually a date, so I created the calculated field "Parameter Date" and cast it as a Date.
          3. Then I created another calc to simply substract 5 from my new Date field. Tableau is smart enough to know I mean 5 days since I am subtracting it from a date field. You could actually just subtract that number in the calculated field built in step 2 instead of creating another calc altogether.

          Hope that helps!

           

          2016-09-14_16-03-02.png

          • 2. Re: Subtract business days from a user selected date
            Saad Beedi

            Thanks for the detailed explanation Lindy. But subtracting the 5 days on the step3 you mentioned above will remove the calendar days and not the business days. For example, if I use the formula "Input date - 7" the calculated field will consider Saturday & Sunday in the calculation of 7 days. I don't want weekends(saturday & sunday) to be part of the calculation. Could you please help with the implementation.