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

or in set analysis

Good day everyone,

The set analysis example below returns the sales for current selection, with new selections both in "Year" AND in "Region",

=sum({$<Year = {2000}, Region = {US, SE, DE, UK, FR}> Sales)

My question is how about for the OR, is there a way for this?

Thanks in advance and more pwoer...

Jason

13 Replies
Not applicable

You can find more examples on page 353 of manual

=sum({$<Year = {2000},Region += {US, SE, DE, UK, FR}>} Sales)

jasonseril
Creator
Creator
Author

Hi Irossi,

Thanks for the reply. Basically the set analysis returns the sales with selections both in "Year" AND "Region. What about for "Year" OR "Region"? Is it correct to have:

=sum({$<Year = {2000} OR Region = {US, SE, DE, UK, FR}>} Sales)

?

Thanks again,

jason

mike_garcia
Luminary Alumni
Luminary Alumni

Hello,

Maybe what you are trying to accomplish is not really something that you would use Set Analysis for.

Think about it... the variables being set using set analysis are not conditions, what you do with set analysis is narrow your universe of information to something very specific, sometimes regardless your selections. If there was a way of using an OR operator in set analysis, you would have two sets of data... how do you define which one to use in your expression?

What I'm guessing is that you want the expression to be evaluated either when the year selected is 2000 or when selecting some of the specified Regions. If my guess is correct, you can use the function getfieldselections.

Hope this helps.

Mike.

Miguel García
Qlik Expert, Author and Trainer
johnw
Champion III
Champion III

An "OR" in set analysis is a union of two sets. You do a union with the "+" operator like so:

sum({<Year={2000}>+<Region={US,SE,DE,UK,FR}> Sales)

jasonseril
Creator
Creator
Author

ok, thank you very much.

jason

prabhu0505
Specialist
Specialist

Please explain with an example, that will help me to implement the concept in my application.

Advance Thanks.

s_uhlig
Partner - Creator
Partner - Creator

Hi John,

could you please verify the sample above, it seems to be a broken feature. It's not working for me in V9R3 and V9R5.

regards

Sven

Not applicable

Hi there, why dont you try splitting the expression in two, like this:

=sum({ $<Year = {2000}> } Sales) + sum({ $<Region = {US, SE, DE, UK, FR}> } Sales)

Regards

s_uhlig
Partner - Creator
Partner - Creator

ps.:

I've just recognised, it's working again in V9R6.

be aware & happy qliking

Sven