Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How match function works?

Hii All,

Please tell me how can we use match() function and how it works?

8 Replies
vivientexier
Partner - Creator II
Partner - Creator II

For example :


=Match( M, 'Jan', 'Fev', 'Mar')

Give you : 2 if M = Fev

Give you : 0 if M = Avr

Not applicable
Author

given that there is a field named 'month' in my qvw file and its value are ('Jan','Feb','Mar','Apr' ).

if i create a pivot table which month as its dimension, the expression is below :

                                       match(month,'Jan','Feb','Mar','Apr')

here is the result :

monthresult
Apr4
Feb2
Jan1
Mar3

is it clear enough?

zhou

thanstad
Creator
Creator

You could also use MATCH Function like if(sum(match,Firstfield,Secondfield,1,0)) which will match results between two fields. This is useful when comparing contents of two fields i.e. in a migration situation. If there are any unequal observations they will come out as 0 else 1.

Tormod Hanstad

Not applicable
Author

thanks Zhou Z,

But if i want to match two different things like:

as ur example:

I want to make a pivot table in which dimension is taken as according to codes

     Table1

col1     col2          col3     col4

jan        01        march     03

feb          02         april     04

and the result to be shown as:

jan     01

feb     02

march     03

april     04

Not applicable
Author

match(month,'Jan','Feb','Mar','Apr')

The result will be:

monthresult
Apr4
Feb2
Jan1
Mar3

it the value of the field month do not match any of the searchstring, result will be zero.
nonzero values can be considered as TRUE and zero is FALSE Poornima Shrivastava

Not applicable
Author


i don't get you. pls make it clear.

Not applicable
Author

hi

see attached file

or try this code

test:

LOAD * Inline [

col1,     col2,          col3,     col4

jan,        01,        march,     03

feb,          02,         april,     04

];

output:

LOAD col1 as month,

     col2 as value

     Resident test;

join

LOAD col3 as month,

     col4 as value

     Resident test;  

drop Table test;

then output like this

monthvalue
jan01
feb02
march03
april04
Not applicable
Author

i got the answer of previous question, actually i was going wrong side..thanks for help..