Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jblomqvist
Specialist
Specialist

How to do nested Pick Match expression?

Hello

I am trying to use the Pick Match expression to do the following.

If EMEA is selected, show orders.

If Asia is shown, show Sales.

My Pick Match expression currently looks like:

But this does not work.

How can I create a nested example like this?

4 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Why would you?

I think this does the job:

=Pick(Match(DivisionName, 'EMEA', 'Asia'), Count(Distinct OrderID), Sum(LineSalesAmount))


Note: this will only work 100% of the time if used in a table with DivisionName as (one of the) Dimension. If you put this in a text box, you must make sure that exactly one DivisionName is selected at all times, or you will get no results.

jblomqvist
Specialist
Specialist
Author

Hi you are right. I got my syntax mixed up. It is a sequence I forgot

Is there a way to provide an else using pick match?

E.g. If nothing is selected then it should say 'Nothing to display'?

krishna_2644
Specialist III
Specialist III

try:

if(getselectedcount(yourselectionfield)>0,

  Pick(Match(DivisionName, 'EMEA', 'Asia'), Count(Distinct OrderID), Sum(LineSalesAmount)),

'Nothing to display')

Peter_Cammaert
Partner - Champion III
Partner - Champion III

IMHO using Pick(Match()) in this case doesn't offer much of an advantage over something simple like:

=IF (DivisionName='EMEA', Count(Distinct OrderID),

     IF (DivisionName = 'Asia', Sum(LineSalesAmount), 'Nothing to show'))

Peter