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

COUNTIF..

Hi,

I want duplicate use of countif

so, I  wrote in the script

=count({<A_FIELD={'111111'}>} and {B_FILED={<C_FILED}[B_FILED])

What this means is that if the A_FILED VALUE = '111111' and B_FILED VALUE < C_FILED VALUE

please count B_FILED VALUE.

BUT,  this doesn't work.

Please help me.

Thank you.

Labels (2)
2 Solutions

Accepted Solutions
BrunPierre
Partner - Master II
Partner - Master II

@PARK_JY  I believe your attempt was to do so with Set Analysis. However, there are syntax errors.

Try this

Sum({<A_FIELD={'111111'},B_FILED={"<C_FILED "}>}DISTINCT B_FILED)

View solution in original post

SchalkF
Contributor III
Contributor III

Hi @PARK_JY 

I would follow the solution @BrunPierre suggested, but as the below since you are looking for a count, and I added in the $ for if there is any selections in your app:

Count({$<A_FIELD={'111111'},B_FILED={"<C_FILED "}>}DISTINCT B_FILED)

If you would like to bypass any selections, use 1 instead of $

Kind regards

View solution in original post

4 Replies
sidhiq91
Specialist II
Specialist II

@PARK_JY  The expression whatever you have written is similar to the Set Analysis.

If you want to replicate that in the Script, then it should be something like below:

if(A_FIELD='111111' and B_FILED VALUE<C_FILED VALUE,B_FILED VALUE) as Value

Then in the front end you can just use below expression.

Count(distinct Value)

Please let me know if this has resolved your issue. 

PARK_JY
Contributor III
Contributor III
Author

oh..i really sorry.

I was wrong. 

I wrote it on the analysis sheet, not the script.

BrunPierre
Partner - Master II
Partner - Master II

@PARK_JY  I believe your attempt was to do so with Set Analysis. However, there are syntax errors.

Try this

Sum({<A_FIELD={'111111'},B_FILED={"<C_FILED "}>}DISTINCT B_FILED)

SchalkF
Contributor III
Contributor III

Hi @PARK_JY 

I would follow the solution @BrunPierre suggested, but as the below since you are looking for a count, and I added in the $ for if there is any selections in your app:

Count({$<A_FIELD={'111111'},B_FILED={"<C_FILED "}>}DISTINCT B_FILED)

If you would like to bypass any selections, use 1 instead of $

Kind regards