Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
arun2305
Contributor III
Contributor III

Count if with a varaible condition

Hi,

I want to measure a number of "Oders" with a variable condition.

Exmepl 33.JPG

count({$<$(vExclusion_Scope)={'YES'}>} Order)

Here "vExclusion_Scope" is a variable were you have "YES" and "NO" as values. And "Order" is a field name.

The formula isn't working, I don't know why ?

Can you please help me with ?

Thank you in advance for your help.

Best regards, Arun

18 Replies
bramkn
Partner - Specialist
Partner - Specialist

I have never tried a variable as the fieldname in a set analysis. U sure this is possible?
pradosh_thakur
Master II
Master II

may be this 

If your order has a one value for vExclusionscope

count({<Order={"=$(vExclusion_Scope)='YES' "}>}Order)
Learning never stops.
basildur
Contributor III
Contributor III

Or perhaps Count( {<$[(vExclusion_Scope)]={'YES' }>} Order )
pradosh_thakur
Master II
Master II

@basildur  @bramkn  only field can be used to set something inside set analysis

you can write  <field = {}>

in this case variable is yea and no and is n't a field so  { variable = {} }  will not work

 

Have a read

https://community.qlik.com/t5/Qlik-Design-Blog/A-Primer-on-Set-Analysis/ba-p/1468344

Learning never stops.
arun2305
Contributor III
Contributor III
Author

Thank you very much Pradosh

It's working fine

Best reagrds, Arun

bramkn
Partner - Specialist
Partner - Specialist

You didnt understand what I was saying.
I know this isn't possible...
arun2305
Contributor III
Contributor III
Author

Pradosh Thakur,

It's not working actually... The number that it is calculating, it's not correct...

 

 

 

pradosh_thakur
Master II
Master II

@bramkn  I must have misread . My applogies.

 

@arun2305  what's your variable looks like ?

Learning never stops.
vishsaggi
Champion III
Champion III

What is the expression in your variable? May be try like below
extending Pradosh's expr give = to in your set
= count({<Order={"=$(=vExclusion_Scope)='YES' "}>}Order)