1 2 Previous Next 18 Replies Latest reply on Oct 7, 2015 1:58 PM by Mike Rudzinski

    Multi-select parameter

    Graham A

      When using a parameter as a fixed value filter would like the ability to select more than one parameter value to act upon

        • 1. Re: Multi-select parameter
          KELLY MARTIN

          I've been struggling with this one as well - thought it might be the way I'd built my calculated measures.  Hopefully some clever tableau master will know of a way.

          • 2. Re: Multi-select parameter
            Joe Mako

            You can use a custom SQL when connecting to your data source, making use of a cross join to full duplicate your data, and then you can use a multi-select quick filter to get what is effectively a multi-select parameter. Richard and I have created a few workbooks on the forum that use this concept.

             

            If you would like more details on how to apply this to your situation. please provide a sample file describe the results/interaction that you want.

            • 3. Re: Multi-select parameter
              Grant Horn

              Hi Joe,

               

              Can you please direct me to those workbooks where you created a multi-select parameter?

               

              I'd really like to see the concept in action.

               

              Thanks,

               

              Grant

              • 4. Re: Multi-select parameter
                Joe Mako

                Grant,

                 

                If you provide an example packaged workbook that represents your situation, and describe what interaction you want, an example can be made for you.

                • 5. Re: Multi-select parameter
                  Grant Horn

                  Hi Joe,

                   

                  Thank you for the quick reply. I've attached an example packaged workbook. A little context:

                   

                  I have two spreadsheets, one spreadsheet contains user information along with comments, the other spreadsheet contains a list of keywords.

                   

                  The objective is to filter the comments based on the keywords. Since I have two separate data sources, I performed the following:

                   

                  1. Created a parameter ("Keywords") with a list of the keywords

                  2. Created a calculated field ("Found Keywords") with the simple formula: CONTAINS([Comments],[Keywords])

                  3. Used the calculated field ("Found Keywords") as a filter to only show 'True' values

                   

                  Everything works as expected, however, I'm limited to selecting only one keyword at a time. Can you please let me know your thoughts on how to create a multi-select filter so I can select several keywords at the same time?

                   

                  Thanks,

                   

                  Grant

                  • 6. Re: Multi-select parameter
                    Richard Leeke

                    Here's an example of this approach in a recent thread.  There are also links to other discussion of the approach in other threads.

                     

                    Re: Scatterplot with size indicating number of records

                    • 7. Re: Multi-select parameter
                      Grant Horn

                      Hi Richard,

                       

                      Thank you for the link.

                       

                      Per Joe's request, I provided my scenario in my previous comment. Please feel free to take a look as well.

                       

                      Your help is much appreciated.

                       

                      Thanks,

                       

                      Grant

                      • 8. Re: Multi-select parameter
                        Joe Mako

                        You can use custom SQL when connecting like:

                         

                         

                        SELECT ['Sample Data$'].[Address] AS [Address],
                        
                           ['Sample Data$'].[Area Code] AS [Area Code],
                          ['Sample Data$'].[City] AS [City],
                          ['Sample Data$'].[Comments] AS [Comments],
                          ['Sample Data$'].[Create Date] AS [Create Date],
                          ['Sample Data$'].[Department] AS [Department],
                          ['Sample Data$'].[Evening Phone] AS [Evening Phone],
                          ['Sample Data$'].[First Name] AS [First Name],
                          ['Sample Data$'].[Last Name] AS [Last Name],
                          ['Sample Data$'].[Site ID] AS [Site ID],
                          ['Sample Data$'].[State] AS [State],
                          ['Sample Data$'].[Zip] AS [Zip],
                          [Keywords$].[Keywords] AS [Keywords]
                        FROM ['Sample Data$'], [Keywords$]
                        


                         

                        this will create a natural join between the two tables, creating a copy of your data for each keyword.

                         

                        Then you can use the multi-select quick filter. When dealing with measures, you will need to be aware of this data duplication. If you need assistance creating the aggregations, post additional details on what you are looking for, and assistance can be provided (sometimes it requires table calculations, other times, just a COUNTD([Keywords]) function).

                        • 9. Re: Multi-select parameter
                          Richard Leeke

                          Of course this lets you select rows that contain any of the keywords chosen.  It needs a bit more work to select roes that contain all of the keywords chosen.  I'm fairly sure I remember doing one of those on a thread a while back using table calculations, but I can't find it...

                          • 10. Re: Multi-select parameter
                            Joe Mako

                            One option would be a calc field like:

                             

                             

                            CASE [Filter Type]
                            
                             WHEN "Has All" THEN COUNTD([Keywords])=TOTAL(COUNTD([Keywords]))
                            WHEN "Has Any" THEN 1=1
                            END
                            


                             

                            based on a parameter, and filtered to keep only when True, as in the attached.

                            • 11. Re: Multi-select parameter
                              Grant Horn

                              Hi Joe and Richard,

                               

                              Thank you for the quick responses and suggestions.

                               

                              I'm going to take a look and let you know if I have any further questions.

                               

                              Thanks,

                               

                              Grant

                              • 12. Re: Multi-select parameter
                                Grant Horn

                                Hi Joe,

                                 

                                Thanks for all the help. Your suggestions are working flawlessly. I have a follow-up question using the same packaged workbook.

                                 

                                Is there a way to highlight the keywords in the comments field?

                                 

                                For example: When we filter for a particular word, the word itself will be highlighted in yellow to make it stand out from the group of text.

                                 

                                Please let me know if you need me to start another thread.

                                • 13. Re: Multi-select parameter
                                  Joe Mako

                                  I do not believe highlighting a word within a text mark is possible in Tableau.

                                  • 14. Re: Multi-select parameter
                                    Grant Horn

                                    Okay, thank you for the quick response.

                                    1 2 Previous Next