1 Reply Latest reply on Sep 13, 2017 12:07 PM by Joe Oppelt

    Search using a multiple value filter

    Gene Wolfkill

      I have a lengthy field (WorkLog) that represents the historical work log for a ticket. I have a filter on my dashboard that lets the user perform a multiple select on a field called (Assignment_Group).


      How can I search for any amount of the items the person selects using the "Assignment_Group" field within the "WorkLog" field? For example, if the user selects 5 items from the "Assignment_Group" filter, and at least one of those values is present in the "WorkLog" field, I want to flag my calculated field as TRUE.


      I've seen numerous cases where you can manually list items using the CONTAIN function, but I'm struggling for a way to be dynamic using the multiple select filter.


      Any/all help is appreciated.

        • 1. Re: Search using a multiple value filter
          Joe Oppelt

          First thing you'll need to contend with is that if the user selects 5 values (and let's assume there are 10 values in the filter) then about half the rows in your data might be filtered out of the sheet.  That's how filters work.


          You can collect a list of all the values the user has selected using a series of table calcs.  A great example of how to do that can be found here:


          Tableau Public


          So that's how you can know what the user has selected.  (Actually, it tells you what dimension values remain in the table underlying your sheet.  There may be filter values he selected that aren't in the table, and the list the calc generates will NOT include those.)


          What you do with that ...  I'm not sure.  What you are looking to do requires some type of array evaluation, and Tableau calcs aren't built to do that.


          The only thing I can see to do here (and I'll admit that I'm not feeling the creativity here) is to have x-many individual calcs that individually evaluate the tokens in the list generated from the example above.  The example uses comma separators, though you can modify it to use whatever you want for that.  Calc-1 will evaluate the first value in the list, Calc-2 will do the second, and I guess you would have to make as many such calcs as you could have in the filter.  Calc 1 would say, "If the mega field CONTAINS() this value, then 1 else 0 END", and then the sum of all n-many evaluation calcs will tell you if any are found.  (If greater than 1, then something was found.)


          It's not pretty.  It will be tedious.  But the building blocks are there.