3 Replies Latest reply on Apr 18, 2018 4:29 PM by Paul Field

    Including and Excluding Filter values based on a particular criteria

    Mahesh Rakwal

      Attached is the mock data on which we are trying to do the following :

      image.png

      We have Configuration Id : which is a part of a car like dashboard of the car or tyres etc. Then we have part attachments which tells you about the parts that make up an entire configuration. For eg : 'head lights', 'rear lights' and 'fog lamps' make up 'Lights'.

      Problem Statement : We need to have 2 filters : Part attachment included and excluded such that, when part attachments included is selected as steering then I get 3 rows(marked in yellow in column E) based on selection. But in the part attachments excluded filter, we don't want the configuration id where the part attachment = 'Headlight'. This means that row no 17 should be eliminated when filtering out headlamps from the filter.

      So basically when part attachment excluded filter excludes 'headlight' then data in row no 17 should not be show in tableau.

      I found this a little difficult to implement using normal filters in tableau.

       

      NOTE : Data Excel Attached

        • 1. Re: Including and Excluding Filter values based on a particular criteria
          Paul Field

          Hi Mahesh,

           

          I have a solution - it's not perfect, depending on your exact requirements.

           

          See attached workbook. First, I have created a field "Concat" which concatenates all part attachment excluded values for a serial number (note: this is hardcoded to the possible values you listed in your example - so it has limitations if there are e.g. hundreds of these and/or they grow over time this probably isn't a good option)

           

          Then I have created a parameter based on the part attachment excluded and then a calculated field to test whether the parameter selection is contained in the concatenated list. We add this to the filters shelf to exclude anything that is contained in the concatenation field.

          • 2. Re: Including and Excluding Filter values based on a particular criteria
            Mahesh Rakwal

            Hi Paul Field

             

            Thanks for your reply.

             

            I also created based on my requirement and it seems of kinda working but request you to check it as i have done by creating custom SQL and parameters.

             

            But the problem with it is that i am not able to show all data when i don't want to  include and exclude.

             

            NOTE : Workbook Attached

             

            Regards

            Mahesh

            • 3. Re: Including and Excluding Filter values based on a particular criteria
              Paul Field

              Hi Mahesh,

               

              If you update your custom SQL to handle the "All" for the include filter, I think it should give you what you're after:

               

              select *  from [sheet1$] A

              where ( A.[part_attachment included] = <Parameters.Include>  or <Parameters.Include> = "All")

              and configuration_id not in (

              (select distinct configuration_id from [sheet1$] where configuration_id in

              ( select distinct configuration_id from

              [sheet1$] where [part_attachment included] = <Parameters.Include> or <Parameters.Include> = "All")

              and [part_attachment included] = <Parameters.Exclude>))