Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Sumit2504
Contributor III
Contributor III

Using If-else with AND and OR operators

@Anil_Babu_Samineni @sunny_talwar 

Hi All,

I want to create a reference line such that if user select Product A, B, C or combination of AB or BC or AC or ABC then it should display 10% in reference line.

Similarly, If product D, E or combination of DE should display 20%. Else 30%.

Can anyone please help me here.

 

Labels (1)
3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

if(Count({<Product={'A','B','C'}>}Product) > 0, .10
,if(Count({<Product={'D','E'}>}Product) > 0, .20
, .30))

-Rob

Anil_Babu_Samineni

Also this

if(Match(Product, 'A','B','C') or Match(Product, 'AB') or Match(Product, 'BC') or Match(Product, 'AC') or Match(Product, 'ABC'), .10, if(Match(Product, 'D','E') or Match(Product, 'DE'), .20, .30))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Heineman579
Contributor
Contributor


@Sumit2504 wrote:

@Anil_Babu_Samineni @sunny_talwar 

Hi All,

I want to create a reference line such that if user select Product A, B, C or combination of AB or BC or AC or ABC then it should display 10% in reference line.

Similarly, If product D, E or combination of DE should display 20%. Else 30%.

Can anyone please help me here.

 


The if/else statement is a logical, conditional expression that evaluates a condition and will only execute the block of code below it, if the condition is true. Please note that you have to use two characters as operator. Read more about JavaScript Operators