5 Replies Latest reply on Aug 17, 2015 7:47 AM by Srikanth Baskaran

    Add a parameter used as a filter to the context

    Srikanth Baskaran

      Hi,

       

      I have a date field on which a parameter is created.

       

      Now, i want to add this date parameter as a context filter to get the exact results,

       

      Is it possible, please advise.

       

      //BR

        • 1. Re: Add a parameter used as a filter to the context
          Vladislav Grigorov

          Hello Srikanth,

           

          I am not sure I understand your requirement, but will give it a try. In the attached file based off superstore I created a date parameter, that is being used to create a context filter via a boolean calculated field. The steps it takes are basically like this:

          1) The parameter you can imagine as an empty box in which the user is able to put (select) a single date. By itself it does nothing than that, it is just a placeholder.

          2) In order to make use of the value that the user sets for the parameter, you should use it in a calculated field. In my case this is the [boolean filter] field that compared the [Order Date] and user selection in the [Date parameter]. This should evaluate to true or false, so I can put it on the filter shelf and select e.g. only records for which the result is true to be visualized.

          3) To make this a context filter you right-click the pill on the filter shelf and select the appropriate option. This basically instructs Tableau send a request to the data source to evaluate the condition first, and then return to Tableau only the resulting set of records that fulfill the condition. This usually causes the database to create a temporary table that stores the result set before sending it to Tableau to do the visualization.

           

          Hope this helps you out!

           

          Vlad

          • 2. Re: Add a parameter used as a filter to the context
            Srikanth Baskaran

            Thanks Vlad,

             

            This is the way it has to be. what you said is correct, we can make it use as context filter.

             

            But my data shows data for not just the selected date but also prior months date. So in that case if make this single date as context filter then it shows only for the current date but my prior months are missing.

             

            We are investigating this , data should show current month as well as prior month (of course the measures calculated on the current month) but the quick filters on the dashboard should only show for the current month selected

            It is bit tricky, still working.

             

            //BR

            • 3. Re: Add a parameter used as a filter to the context
              Vladislav Grigorov

              Srikanth,

               

              You can define any condition in the boolean field to filter on. In your case you put a condition so that your date field is <= than the parameter, and it should show dates up until the parameter date. I'm already at home, so I could have another look on Monday if you still need help with this.

              Best!

               

              Sent from my iPhone

              • 4. Re: Add a parameter used as a filter to the context
                Vladislav Grigorov

                Srinkath, do you still need help with this?

                • 5. Re: Add a parameter used as a filter to the context
                  Srikanth Baskaran

                  Hi Vlad,

                   

                  yes, we need help on this and thanks for your time.

                   

                  we have a date parameter to select a date. a parameter to select prior months and we have 3 quick filters.

                   

                  When i select Jan, we get the data for current month and also dec , nov for prior months. the quick filters should get filter based on the current month selection and not on prior months too.

                   

                  So, in the quick filters instead of getting values listed only for Jan, we have entries for Nov & december too.

                   

                  This is where we are stuck.

                   

                  //BR