3 Replies Latest reply on Dec 14, 2013 12:24 PM by Ayman Teradata

# Using parameter to filter dates

I am trying to utilize a Parameter (Quarter Selection Parameter) as a Date Filter to control the view of a simple bar chart. I want to allow the user to filter the view by year quarter using a list (i.e. 2012 Q1, 2012 Q2, etc.) . See desired View below:

I first created a parameter named Quarter Selection Parameter

I then created a Calculation named Quarter Selection Calc. I tried to use the Calc both with and without wrapping the Quarter Selection Parameter in the DATE function.

When I attempt to place the Quarter Selection Calc in the Filters Shelve, and select to filter by Quarters, this is what I see:

What I want to see on this filter setup is a list of the Date Quarters that have been set up in the Quarter Selection Parameter. i.e. 2012 Q1, 2012 Q2, 2012 Q3, etc.  so that I can control the date filter by the Quarter Selection Parameter

This has frustrated me for a couple of days. What am I doing wrong?

Thanks in advance for you time, thoughts and any suggested solutions.

Pat Lefler

• ###### 1. Re: Using parameter to filter dates

Patrick,

The only thing your calculation does is to return the selected parameter. So it`s normal that only the parameter selected shows in the filter.

What you want as a filter is  a boolean calculation that answer the question;  is the Date on the axis within the range of the selected parameter.  Next bring that calculation on the Filters shelf  and filter at True.

See the attach

Michel

1 of 1 people found this helpful
• ###### 2. Re: Using parameter to filter dates

Many thanks Michel. This had stumped me for the better part of the week.

• ###### 3. Re: Using parameter to filter dates

That's how I do it too, using a calculated field with an IF statement checking the date is between the minimum and maximum dates I get from 2 date parameters. Then I put the new calculated field on the filter shelf and select the criteria of filtering the value 'TRUE'.

It would be good though if Tableau would support range-date filters to get minimum and maximum values directly from parameters instead of having to do a calculated-field in-between.