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: 
SMiller_FL
Contributor III
Contributor III

Or statement in count

I created 2 new fields to try to help solve this.  One is FlagField4, the other is FlagField5. Now I want to count all those that are in the column [Tier-TierNum] and are a 2. I also need those that are if they are 'bad' in  Flagfield4 OR if they are 'bad' in Flagfield5. 

I have this so far and it is of course not working:

Count({<[Tier-TierNum]=['2'},flagfield4={'bad'} or flagfield5={'bad'}>}[Tier-TierNum])

How do I get it to see the OR between the 2 separate flagfields equally? I tried adding another flagfield but OR does not appear to be recognized in the data editor menus because  the following works in the Sheets if I just add it as a column on a table but will not work as a new field in the data manager. 

if(flagfield4='bad' or flagfield5='bad','bad','ok') 

I'm so stuck.

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

As below

 

=Count({

<[Tier-TierNum]={'2'},flagfield4={'bad'} >+<[Tier-TierNum]={'2'},flagfield5={'bad'}>

}[Tier-TierNum])

 

 

Refer below blog

https://www.analyticsvidhya.com/blog/2014/01/set-analysis-qlikview/

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

6 Replies
Taoufiq_Zarra

@SMiller_FL  can you share a sample data and the expected output ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
SMiller_FL
Contributor III
Contributor III
Author

here is some sample data:

Tier-Tiernum flagfield4 flagfield5
4 ok ok
2 ok bad
4 bad bad
3 bad ok
2 ok bad
1 ok ok
2 bad bad
2 bad ok
     
count = 4    
SMiller_FL
Contributor III
Contributor III
Author

Sorry, let me give you a getter example:

Tier-Tiernum flagfield4 flagfield5  
4 ok ok  
2 ok bad  it counts
4 bad bad  
3 bad ok  
2 ok bad  it counts
1 ok ok  
2 bad bad  it counts
2 bad ok  it counts
2 ok ok  
2 ok ok  
       
  Total = 4    
edwin
Master II
Master II

try

Count({<[Tier-TierNum]=['2'},flagfield4={'bad'} >+< [Tier-TierNum]=['2'},flagfield5={'bad'}>}[Tier-TierNum])

the + between the two set analysis modifiers i sthe equivalent of an OR

vinieme12
Champion III
Champion III

As below

 

=Count({

<[Tier-TierNum]={'2'},flagfield4={'bad'} >+<[Tier-TierNum]={'2'},flagfield5={'bad'}>

}[Tier-TierNum])

 

 

Refer below blog

https://www.analyticsvidhya.com/blog/2014/01/set-analysis-qlikview/

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
SMiller_FL
Contributor III
Contributor III
Author

Thanks, knowing he plus sign is the equivalent of OR helps.