Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

adam_tate
New Contributor II

How to add a sort of "WHERE" clause filter?

HI all,

I have added a table to my dashboard, is there a simple way of adding a "where" type clause such as

"Salesperson = "Adam" OR SalesPerson = "bob"?

I am playing around with the expression editor but cannot find the correct syntax. If I use Salesperson = "Adam" it will filter the result down correctly but the label on the row that that given field will be changed to "0" & "1".


Thanks in advance

4 Replies
felipedl
Valued Contributor III

Re: How to add a sort of "WHERE" clause filter?

Hi Adam, there's the set analysis feature, that lets you do this "selection" on the expression, from Qlik Help:

Set analysis and set expressions ‒ Qlik Sense

So, if you need something like sum of sales by salesperson Adam or Bob you could do something like:

sum( {<SalesPerson={'Adam','Bob'}>} )

The text between {} is the set expression, and no matter if you choose a different salesperson on a filter, the expresison will not change for this filter, since it's hardcoded to Adam or Bob.

The expression you used: "if(SalesPerson = "Adam") will evaluate to true or false since it's a binary return and will not give you a sum or other type of aggregation, giving you the 0s and 1s.

For example, the image below, with some dummy data, has in the red rectangle all the data I loaded, and the yellow one the expression where I hardcoded the two sales person.

Sample.png

Even though i select one salesperson, say Sally, the yellow table doesn't change because it has a set analysis, but the red one respects the selection.

Sample.png

The picture below shows the type of expresison I guess you were trying,

Sample.png

Hope it helps,

Felipe.

adam_tate
New Contributor II

Re: How to add a sort of "WHERE" clause filter?

Thankyou for your help, I understand now

felipedl
Valued Contributor III

Re: How to add a sort of "WHERE" clause filter?

Glad to help Adam, could you mark the response as correct if you see that's the case?

Thanks,

Felipe.

snehalameya
New Contributor II

Re: How to add a sort of "WHERE" clause filter?

Hi,

Please use set analysis to filter in this case,

sum( {<SalesPerson={'Adam','Bob'}>} ).

This statement will filter your table by Adam and Bob.

Regards,

Snehal Nabar

Community Browser