Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Applicable88
Creator III
Creator III

Combination of IF and MATCH function

Hello Qlikcommunity,

really struggle to understand what I can do with a match function. Even more difficult when combined with a if -function. 

My case here......I have basically a table like that: 

SerialnumberMaterialDeliverynumberPosDate of packingSerial-Grouping
BA1234567811B2010415401051001.04.2020BA
BA2003012184B2011415400981001.04.2020BA
BM2003012232B2012415401681001.04.2020BM
BM2003010719B2013415401581001.04.2020BM
BM2003012231B2013415401671001.04.2020BM
GM2003010719B2010415400933002.04.2020GM
GM2003012231B2010415400933002.04.2020GM

As you can see in the last column I have the prefix listed from the serialnumber which you can see in the first column.

I created an easy bar chart counting the serialnumbers. 

Now I wanted to have a range slider with this f(x): 

=If(Match([Serial-Grouping],'BA','BM'), Selfmade')

I don't know why exactly, but when I switch that rangeslider on it really shows me ONLY the delivery orders with the both prefixes BA and BM.  So what is this function actually doing? 

I just played around to understand what match is really doing so I make another slider with the following :

=Match([Serial-Grouping],'BM','BF')

As you can see the if -function is gone . But now I have a rangeslider box with two sliders options. One is calle 0 and the other 1. But if I turn both on I dont get the same results in the filter of the bar chart like the first function.

I hope someone can explain to me in plain words. 

Thank you very much and I wish all well. 

 

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I assume you are missing a quote around 'Selfmade' in the example you posted. 

In Qlik, 0 is False and anything else is True.  So anything that matches in your list will be True and will return the string 'Selfmade'.  

You did not provide a third parameter for If(), which is the result for False.  Default for the missing third parameter is Null().  Null values are not included in Count(). 

So yes, you only count those that are in the match list.

-Rob

View solution in original post

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I can see why what you have shown doesn't work.  But I don't understand what you want to accomplish?

-Rob

Applicable88
Creator III
Creator III
Author

Hi Rob,

I try to explain what I meant. The table you can see is the only table I used for that app. 

I build a bar diagram where I could have filter all serial numbers with something like a set expression à la = count{$<{Serialnumber=('BA','BM'}>}serialnumber)

But I chose to do leave that task for a range slider :     =If(Match([Serial-Grouping],'BA','BM'), Selfmade')

I just wonder what that expression does, because it works. When I turn the slider on, the bar diagram automatically counts only BA,BM values like the aforementioned set analysis. And the slider get the name "Selfmade" at the end of the if function. 

Why is that? Are all values bigger of the match function bigger than 0 automatically TRUE? And so the If function will counts them? 

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I assume you are missing a quote around 'Selfmade' in the example you posted. 

In Qlik, 0 is False and anything else is True.  So anything that matches in your list will be True and will return the string 'Selfmade'.  

You did not provide a third parameter for If(), which is the result for False.  Default for the missing third parameter is Null().  Null values are not included in Count(). 

So yes, you only count those that are in the match list.

-Rob