10 Replies Latest reply on Dec 6, 2017 8:15 AM by Jack Smilovitz Branched to a new discussion.

    OR filter

    Jack Smilovitz

      Hi TC,


      How can I create multiple filters in a dashboard that can satisfy an "OR" condition? Meaning, if filter A and filter B are "on" how can that return the value if present in any of these fields instead of it is present in both?


      See example below:

      data example I.pngDb exampleII.png


      Here I would like to return all customers that have either product 1 OR product 2  - it seems that when I set the filter of product 3 to null it removes all the instances when a customer has a combination of product 3 and another one.


      Any ideas how can I solve this?


      Many thanks


        • 1. Re: OR filter
          Joe Oppelt

          Is your actual application and data as straightforward as the example you described?  (Essentially binary yes/no selection for a few specific products.)  If so, you can set it up with parameters.  Actually, even if it is more complicated you can do it with parameters, but it will be tedious.  Same thing if "Product 1" and "Product 2" and "Product 3" are fixed values.


          If you have parameters you can then make a calc that examines the three parameters and decide if you want to keep the customer.

          • 2. Re: OR filter
            Jack Smilovitz

            Hi Joe,


            Thanks for your answer.


            The data is a bit more complex than this, there are over 15 products and 60K+ customers.  If I understand correctly, I would have to create a parameter for every possible product combination, right? Would that be the case? If so, is there any alternative to this?




            • 3. Re: OR filter
              Joe Oppelt

              Do you always want to check for (up to) three different products?  Or can it be any number from 1-through-N?


              Does your list of products change?


              When you check for "Null" for a given product, does that mean you are looking for a customer who has Product 1 or Product 2, but definitely does not have Product 3?

              • 4. Re: OR filter
                Joe Oppelt

                One more question:  Assuming there are up to N products you are examining, will the list of examined products change?

                • 5. Re: OR filter
                  Jack Smilovitz

                  Hey Joe,


                  - It can be any number, actually up to 15 products.


                  - The list of products (columns) doesn't change, there are always the same 15.


                  - Here is the tricky bit...When clicking "Null" for a given product this doesn't necessarily have to be excluded. For example, If I click "yes" for Product 1 and 2  & click "null" for Product  3 - and a customer has all three products I do want to account for him. So the "Yes" overwrites the "null".    ---> The question that the final number satisfies, in this case, is: how many customers have Product 1 and/or Product 2?

                  1 of 1 people found this helpful
                  • 6. Re: OR filter
                    Joe Oppelt

                    Let's start working with an actual example.


                    The attached is an 8.2 version workbook.


                    I display customers.  I have a filter on [Item].  When I select 2 items, I get the customers who have that item.  That's essentially what you are looking to do.


                    This works in a very straightforward way because there is a separate row in the data for each item a customer has.


                    If I understand correctly though, you have one row per customer, with separate columns for all 15 items.  Is this correct?


                    If so, you can PIVOT your columns under EDIT DATA SOURCE, and virtually create those separate rows.  Tableau will do that for you without you having to change your actual data source.  If you need help doing that, I can show you if you upload a sample workbook.

                    1 of 1 people found this helpful
                    • 7. Re: OR filter
                      Jack Smilovitz

                      Hi Joe,


                      Thank you for your reply.


                      I cant see the attachment, could you please send it again?


                      To your question, that's correct, there's a row per customer with separate columns for all 15 items.



                      • 8. Re: OR filter
                        Joe Oppelt

                        My bad.



                        1 of 1 people found this helpful
                        • 9. Re: OR filter
                          Joe Oppelt

                          As for your data, can you create a sample excel file with a handful of rows using your data?  Tell me your tableau version.  I'll take your file, and show you how to pivot the data so you can make your requirements easy to generate.

                          1 of 1 people found this helpful
                          • 10. Re: OR filter
                            Jack Smilovitz

                            Genius, this works!


                            Many thanks for all your help Joe!