3 Replies Latest reply on Mar 21, 2016 12:54 AM by Ben Kiviti

    This month option on calculated field

    Ben Kiviti

      Hello to the great community of Tableau,


      I will start by explaining that at the moment I am still using Tableau 7, moving to the latest version soon.

      With that being said,

      I have a problem using calculated field and asking it to return "this month" info

      While there is a built in filter on date fields that return this month and let you choose between relative months, I would like to give that specific option to whoever opens a specific dashboard.
      for that purpose, I made 3 parameters:

           Date Type           String parameter that let you choose from "This Month" or "Date Range"

           Starting Date      Date parameter that let you choose a specific date

           Ending Date        Date parameter that let you choose a specific date

       

      Using this parameters I'm trying to make a logic that if "this Month" is selected then Tableau query regarding date = this month

      If date range is selected then tableau query date range according to the starting and end parameters.

      My logic is as follows

      IF [Date Type]="This Month" and [Date]=Thismonth()

      Then 1

      ELSEIF [Date Type]="Date Range" and [Date]>=[Starting Date] and [Date]<=[Ending Date]

      Then 1

      ELSE 0

      END

       

      Sadly tableau does not have an option for this month like it has for today()
      would wppreciate any help

      Regards,
      Ben Kiviti