Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
So I have a data set with one column listing names of employees and one listing job roles. Field names of the columns are 'Full Name' and 'Title', respectively. I wanted to know how I can use an IF statement to select only the names with job roles containing the words 'Sales' and 'President' and use those selections as a dimension in a filter pane.
Is there an expression i can use for this?
Thanks
Use this expression as the dimension in the filter pane...
=Aggr(Only({< Title={"*president*", "*sales*"} >} Title), Title)
Then change the label to "Title".
This is better than an "if" statement, because it enable Qlik to recognize this as the "Title" field and have it correctly show in the Selections at top.
See more information on this technique in this post on my blog. (http://qlikwithfriends.com/index.php/2018/02/25/using-aggr-instead-of-if-for-complex-dimensions/)
I hope this helps.
Hi,
You can use below expression in Filter Pane
=if (Title='Sales' or Title='President', Full_Name)
Regards,
Nikita Deshwal
Hi Nikita,
This would work if you wanted to match those exactly, but the request was to do a "contains" comparison.
The IF statement could still be used is we substitute "WildMatch".
=if (WildMatch(Title, '*Sales*', '*President*'), Full_Name)
I tend not to use "If" when doing this in filters or dimensions. I use Aggr instead. Take a look at the blog post mentioned in my prior response and you'll see why.
Leslie
You have three replies below and given you have not commented further I am assuming one of them is what you needed, please be sure to close out your thread by returning to it and on any posts that helped, use the Accept as Solution button to mark them which gives the poster(s) credit for the help and lets other Member's know what worked. It is greatly appreciated if you close out your threads on Community.
Regards,
Brett