qliksense

QlikSense: Using an OR in filter pane


Is there a way in QlikSense to use a single filter value to search across multiple objects?

enter image description here

So in my example above, I want to be able to select one value, but have it look at every object. These rows are all correlated, as well. Here's an example of the SQL data:

enter image description here

The most straight forward path would be to have 3 separate filters for the Drug (Drug1, Drug2 and Drug3) but I'd prefer to have one filter search across all 3 of these. Hopefully this is a clear enough explanation for what I'm trying to do.

I tried using an expression in the filter pane: = drug1 OR drug2 OR drug3 but this didn't work.


Solution

  • You can achieve this by using a variable, a variable input object (textbox), and some set analysis.

    1. Create a new empty variable in the sheet editor called vSearchString.
    2. Add a new variable input object to the sheet, make it a textbox, and then choose the vSearchString variable.
    3. In your table object, use this as your drug1 dimension:

    ->

    =Aggr(Only({
        <[drug1] = P({< [drug1]={"*$(vSearchString)*"} >})>
      + <[drug1] = P({< [drug2]={"*$(vSearchString)*"} >})>
      + <[drug1] = P({< [drug3]={"*$(vSearchString)*"} >})>
      } [drug1]), [drug1])
    

    ...Then, use this as your drug2 dimension:

    =Aggr(Only({
        <[drug2] = P({< [drug1]={"*$(vSearchString)*"} >})>
      + <[drug2] = P({< [drug2]={"*$(vSearchString)*"} >})>
      + <[drug2] = P({< [drug3]={"*$(vSearchString)*"} >})>
      } [drug2]), [drug2])
    

    ...And finally, use this as your drug3 dimension:

    =Aggr(Only({
        <[drug3] = P({< [drug1]={"*$(vSearchString)*"} >})>
      + <[drug3] = P({< [drug2]={"*$(vSearchString)*"} >})>
      + <[drug3] = P({< [drug3]={"*$(vSearchString)*"} >})>
      } [drug3]), [drug3])
    

    That should be enough to get it working:

    Screen recording of using the multi-field search

    Those Qlik expressions shown above utilize a few different concepts: