Is there a way in QlikSense to use a single filter value to search across multiple objects?
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:
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.
You can achieve this by using a variable, a variable input object (textbox), and some set analysis.
vSearchString
.vSearchString
variable.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:
Those Qlik expressions shown above utilize a few different concepts:
Aggr()
function
GROUP BY
clause.=Aggr(Sum([Profit]), [RegionDim], [SalespersonDim])
.Only()
aggregation (see next bullet point) to use set analysis (see bullet point after next).Only()
function
Aggr()
function (see above) to group those results by that same field ([drug1]
/[drug2]
/[drug3]
).WHERE
clause for chart expressions in Qlik.{<[SomeField] = {'Some value or expression'}>}
.P()
set function
P
stands for "possible."[SomeField] = 'Some value'
".+
) set operator
AND
used to combine several "sets" or set analysis records.