2 Replies Latest reply on Mar 24, 2017 2:43 PM by Juliana Lim

    MTD parameter equals YTD parameter

    Juliana Lim

      Hi fellow Tableau users

       

      First time using the community to ask questions. Hope the experts would be able to help me.

      I've got two parameters - one for month to date and one for year to date. Is it possible to make one dependent on the other? For example, when I filter the MTD parameter to Mar, the YTD parameter will change to Mar automatically. I cannot use one parameter for both since the calculations are different.

       

      Here are the calculations I used:

       

      MTD parameter filter

      CASE [Month to Date Parameter]

      WHEN "Last Month" THEN (IF YEAR([Period])=YEAR(TODAY()) AND

      MONTH([Period])=MONTH(TODAY())-1

      THEN "TRUE"

      ELSE "FALSE"

      END)

       

      [followed by 1 to 12 for each month, only 12 is shown]

      WHEN "12" THEN (IF YEAR([Period])=YEAR(TODAY()) AND

      MONTH([Period])=12

      THEN "TRUE"

      ELSE "FALSE"

      END)

       

       

      END

       

      YTD parameter filter

      CASE [Year to Date Parameter]

      WHEN "Last Month" THEN (IF YEAR([Period])=YEAR(TODAY()) AND

      DATEPART('month',[Period])<DATEPART('month',TODAY())

      THEN "TRUE"

      ELSE "FALSE"

      END)

       

      [followed by 1 to 12 for each month, only 12 is shown]

      WHEN "12" THEN (IF YEAR([Period])=YEAR(TODAY()) AND

      DATEPART('month',[Period])<=12

      THEN "TRUE"

      ELSE "FALSE"

      END)

      END

       

      Appreciate any help. Thanks!