3 Replies Latest reply on Feb 16, 2016 7:29 AM by Tableau kumar

    Parameter Issue

    SambiReddy Chanimella

      Hi All,

       

      I got issue with parameter where iam trying to find 'sales' of Sub-category for Last >15days,>30days,>45days from today date. So i created a parameter for 15days,30days and 45days and i wrote calc like

       

      if [Days] = "15 days" and DATEDIFF('day',TODAY(),[Order Date])< 15 then "Show"

      elseif [Days] = "30 days" and DATEDIFF('day',TODAY(),[Order Date])< 30 then "Show"

      ELSEIF  [Days] = "45 days" and DATEDIFF('day',TODAY(),[Order Date])< 45 then "Show"

      ELSE "Hide"

      END

       

      but above calc is not affecting view and i attached twbx file so can someone pls look into my issue and correct me where iam making erro

       

      (twbx file is in 9.1version)

       

       

      Thanks

        • 1. Re: Parameter Issue
          Adam Crahen

          Hi SambiReddy-

           

          The start date (earlier date) comes first in the DATEDIFF calc. 

           

          if [Days] = "15 days" and DATEDIFF('day',[Order Date], TODAY())< 15 then "Show"

          elseif [Days] = "30 days" and DATEDIFF('day',[Order Date], TODAY())< 30 then "Show"

          ELSEIF  [Days] = "45 days" and DATEDIFF('day',[Order Date], TODAY())< 45 then "Show"

          ELSE "Hide"

          END

           

          However, the superstore sample you have worked up won't return any results because the order dates are so much earlier than today.

          1 of 1 people found this helpful
          • 2. Re: Parameter Issue
            Shinichiro Murakami

            I guess you need this formula.

             

            [Time Filter (copy)]

            if DATEDIFF('day',[Order Date],[Date Select])< int(left(str([Days]),2))

            and [Date Select]>=[Order Date] then "Show"

            ELSE "Hide"

            END

             

            I used [Date select ] instead of [today()], because there are no available [date]s when I use today().

             

            <<<Current>>>

            if [Days] = "15 days" and DATEDIFF('day',TODAY(),[Order Date])< 15 then "Show"

            elseif [Days] = "30 days" and DATEDIFF('day',TODAY(),[Order Date])< 30 then "Show"

            ELSEIF  [Days] = "45 days" and DATEDIFF('day',TODAY(),[Order Date])< 45 then "Show"

            ELSE "Hide"

            END

            Thanks,

            Shin

            1 of 1 people found this helpful
            • 3. Re: Parameter Issue
              Tableau kumar

              Datedifference function deduct from second date to first date.

              Datedifference('month',(order date),today()) deducts like today()-(order date)