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

# MTD parameter equals YTD parameter

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!

• ###### 1. Re: MTD parameter equals YTD parameter

Hi Julian,

You can manage multiple calculated fields with single parameter. But in your case duplicate the date field [Period] and give some different name like [Date Period].

Use the [Date Period] field on YTD parameter and keep the [period] field for MTD parameter.

Thanks

Akram

2 of 2 people found this helpful
• ###### 2. Re: MTD parameter equals YTD parameter

Thank you, Akram! Works perfectly.