2 Replies Latest reply on Jun 29, 2016 2:06 AM by Anoop Odedra

    Filter Previous 6 months data on the filter selection (without parameter)

    Ravi Keswani



      I am a new to Tableau.


      I have a date quick filter so when I select a date, it should display last six months data from selected date.

      For example, if I select "November 2015" in my filter, then it should display the Values for November 2015, October 2015, September 2015, August 2015, July 2015 and June 2015


      My dataset looks like this:


      [Date]                                   [Product]                              [Expense]


      June 2015                              Product 1                              X1

      July 2015                              Product 1                              X2

      August 2015                          Product 1                              X3

      September 2015                     Product 1                              X4

      October 2015                         Product 1                              X5

      November 2015                     Product 1                              X6



      I want to do this without the creating "parameter"

      Any quick help is appreciated.



        • 1. Re: Filter Previous 6 months data on the filter selection (without parameter)
          Mark Fraser

          Hi Ravi

          I am a new to Tableau.

          I appreciate you are new to Tableau.

          A filter is applied to data to reduce the data based on the conditions of the filter(s). Therefore if I filter your data on November 2015, I only have November 2015 data, there is no 6 months before to display.

          The reason parameters are used in place of filters is that they act outside of the filter, and therefore are not restricted by applied filters (all your data is still there, we can then choose what to display)


          So in your example you would use a parameter with a logic test

          The logic test acts as the filter, in place of a 'filter'


          I can help you further, but you need to get this concept




          • 2. Re: Filter Previous 6 months data on the filter selection (without parameter)
            Anoop Odedra

            Hi Ravi,


            to obtain this functionality you would need to use a parameter with a calculated field as your filter.


            The calculated field would be something along the lines of:


            if datetrunc('month',[Date])>Dateadd('month',-6,datetrunc('month',[Parameter Date Selection])) and [Date]<=Datetrunc('month',[Parameter Date Selection]) then '1' else '0' End


            Place this field onto the filter shelf and then whichever date is selected in a given month in the parameter, the worksheet will show the selected month and 5 months prior.


            As Mark has said, if you filter to November 15 data, all you have is 1 month of data so the best way to fix this is with the use of a paramer.


            Hope that helps!