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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

AND OR combination condition in set analysis

Hi All,

I have a requirement where I need to use OR condition in set analysis.

This is my exact requirement what i am looking for.

[GIDFLAG={'0'} and BS ={'A','B'} and region={'US'} and [Channel ={'A','B','C'} or ( Channel ={'D'} and custno={'1','2,'3'} )] and

vDeli={'LCD'} and PSI='S11]

Every time I have been failing in underlined condition.

how we can use above condition in set analysis function,Any suggestions should appreciates.

Thanks

12 Replies
andrejfreitas
Partner - Creator
Partner - Creator

Hello,


I have a question:

Is there a way to add a fixed AND selection that will impact all the or's selection in the set analysis ?

For instance, using your example, let's say I would like to add Channel={'D'} in both part of the set analysis.

As a result, we would have something like:

sum({<GIDFLA={'0'}, BS={'A','B'}, Region={'US'}, Channel={'A','B','C'},Channel={'D'}> + <GIDFLA={'0'}, BS={'A','B'}, Region={'US'}, Channel={'D'}, custno={'1','2,'3'}>}sales); (this should work)

However, since Channel={'D'} is a common element in both part of the expressions, I was wondering if there is a way to write it once; Something like that:

sum({<Channel={'D'}>, <GIDFLA={'0'}, BS={'A','B'}, Region={'US'}, Channel={'A','B','C'}> + <GIDFLA={'0'}, BS={'A','B'}, Region={'US'}, custno={'1','2,'3'}>}sales); (this shouldn't work)


That would mean, Channel={'D'} would impact in both sides of the expression. That would save a lot of time.


Any ideas?


Thank you!





jyothish8807
Master II
Master II

Try this once:

sum({<sales=p({<GIDFLA={'0'}, BS={'A','B'}, Region={'US'}, Channel={'A','B','C'}>})+ p({<GIDFLA={'0'}, BS={'A','B'}, Region={'US'}, custno={'1','2,'3'}>}),Channel={'D'}>}sales)

Br,

KC

Best Regards,
KC
andrejfreitas
Partner - Creator
Partner - Creator

Thanks for your response.

It didn't work for me in this way. See my expression below.

sum({< BOCount=

p({<[Reporting Year]={'$(vCurrentReportingYear)'}>})+

p({<[Reporting Year]={'$(vPreviousReportingYear)'}>})+

p({<[Reporting Year]={'$(vPenultimateReportingYear)'}>}), Base_Example={1}>} BOCount)