3 Replies Latest reply on Aug 8, 2018 2:13 AM by Rajeev Pandey

    Apply date filters to Set calculations

    Mehak Babbar

      How to create sets in tableau where the result of set(IN/OUT) should be recalculated whenever date range is changed from date filter.

        • 1. Re: Apply date filters to Set calculations
          Mark Holtz

          Hi Mehak,


          It would be helpful if you could provide some sample data and/or a packaged workbook. (.twbx)


          How is your date range defined?

          Is it always fixed in duration (30 days)?

          Are the start and end dates able to be changed independently?


          If you are wanting to show records whose date value falls between two date values AS WELL AS the records whose date falls outside the values, you won't want to use a filter.

          Filtering removes the records which do not qualify.


          If you want to be able to group the results into a set, you could use one (if your date range is always fixed in duration--like 30 days--you can derive the other endpoint) or two parameters to establish the endpoints of the date range and then use a calculated field or build a set to group records in or out.



          Create [Start Date Parameter] as a Date (let's say you set it to 6/1/2018).

          Create [End Date Parameter] as a Date (let's say you set it to 7/31/2018).


          Create a Calculated Field [Within Date Range?] as:

          IF [RecordDateValue] >= [Start Date Parameter] AND [RecordDateValue] <= [End Date Parameter] THEN 'In Range'

          ELSE 'Out of Range'



          You can then use this field as a dimension to split your view.

          Records with dates <= 5/31/2018, as well as records with date >= 8/1/2018 will all fall in 'Out of Range'.


          If that isn't what you're looking for, please provide more information.

          • 2. Re: Apply date filters to Set calculations
            Ritesh Bisht

            Hi Mehak,


            It should change.


            For example


            Screen Shot 2018-08-08 at 1.51.00 PM.png



            I have a set  @ Customer with Top 5 profit


            Screen Shot 2018-08-08 at 1.51.37 PM.png




            Screen Shot 2018-08-08 at 1.51.46 PM.png


            Now with the change in Order Date range I can see the change @ View, please find the attached  as well


            Where are you finding issues ?




            • 3. Re: Apply date filters to Set calculations
              Rajeev Pandey

              Just to add one more point /Ritest techniques will surely work,

              In addition to that, do change the set action from dimension action to context action.

              In simple words, change In set to get the most updated and relevant records.

              Right click on IN set action ->Add it to context