Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis: Get distinct values

Hi Experts,

I am held up with the below problem.

I have (say) 20 zipcodes, of which 8 zipcodes(4 distinct) are of 'Type'=Store and others are of type 'Sales'. I wish to get the all the values of type 'store' in a variable and assign to each of them with with a color code.

How do i achieve it? Should I use if statement or Set Analysis?

Thanks for your time.

Regards,

Pramod K

1 Solution

Accepted Solutions
datanibbler
Champion
Champion

Hi Pramod,

both ways are possible.

I would suggest using an IF_statement, just because set_analysis is tricky. That would look sth. like this

>>> = IF((type = 'store' and [zipcode] = '12345'), [your_colour]) <<<

or, maybe even simpler,

>>> = IF(type = 'store',

               PICK(MATCH([zipcode], [code1], [code2]), [colour1], [colour2])) <<<

=> That way, the type will be queried first and the inner query will only ever be executed for those codes of type 'store' to begin with - that might be more efficient resource-wise.

HTH

Best regards,

DataNibbler

View solution in original post

5 Replies
Gysbert_Wassenaar

You can put this expression in a variable: =concat({<Type={store}>}distinct zipcode, ',' )


talk is cheap, supply exceeds demand
MK_QSL
MVP
MVP

Where exactly you want to use this color?

I.e. Straight Table or in any other object?

datanibbler
Champion
Champion

Hi Pramod,

both ways are possible.

I would suggest using an IF_statement, just because set_analysis is tricky. That would look sth. like this

>>> = IF((type = 'store' and [zipcode] = '12345'), [your_colour]) <<<

or, maybe even simpler,

>>> = IF(type = 'store',

               PICK(MATCH([zipcode], [code1], [code2]), [colour1], [colour2])) <<<

=> That way, the type will be queried first and the inner query will only ever be executed for those codes of type 'store' to begin with - that might be more efficient resource-wise.

HTH

Best regards,

DataNibbler

Not applicable
Author

I will be using these color codes in the Color expression on Qlikmap..

Not applicable
Author

Thank you very much.. it worked