Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
RanOuerg
Creator
Creator

Pick match function is not working

Hello all,

Due to performance issues, I aimed to replace the nested if with Pick and Match, but encountered problems. I used the following formula in a column's background color: pick(match(($(variable) > 10000), true()), red(), green()). However, this approach didn't work as expected. When I tried using an if statement instead, I obtained the correct results. Any insights into what might be causing the issue?"

Thank you in advance.

Labels (3)
7 Replies
Anil_Babu_Samineni

@RanOuerg Not sure the use of True() here. perhaps this?

pick(match(($(variable)) > 10000)+1,  green(), red())

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
RanOuerg
Creator
Creator
Author

i remplaced true() with 1 but it still not working

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Pick(Match()) will generally perform no faster or slower than an if().  If the if() function works for you, I would go with that. If this is causing you performance issues, the issue is likely in the $(variable) expression. 

-Rob

RanOuerg
Creator
Creator
Author

Understand, but why it not working ? what is the issue with my formula

marcus_sommer

Your match() could result in two values - 0 for a non-matching and 1 if the variable-comparing returned true(). The 0 couldn't be fetched from pick() because their index starts with 1. To comprehend it I suggest to split it into several parts, like:

$(variable)
$(variable) > 10000
match(($(variable) > 10000), true())

beside each other.

RanOuerg
Creator
Creator
Author

i don't see how can i split my formula, i don't really understand your solution.

Thank you for adding more details please?

marcus_sommer

Just use each part as an own expression within a table-chart. Each nested expression is resolved starting from the most inner expression-part and then next wrapping one takes the result as parameter and performed the own calculation with it.

The aim by separating all expression-parts is to comprehend the single results and their evolution within the expression-chain to detect logically issues which will occur if the results are unexpected in any way.