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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

Count expression incorrect

HI guys,

I;ve managed to get a list of new records based on script.  but i dunno what is missing.

=Count(DISTINCT {<risk_item_id = e({<risk_item_id = {"=Count({<batch_year = {'<$(=Max(batch_year))'}>} risk_item_id) > 0"}>})>} risk_item_id)

Based on the above script - i manage to get the correct new records - which is 67.

But when select filter  risk1 'low and risk2 'low' then i got the wrong figure, 104. is wrong.

The result should be 49, after i have filtered with risk1 and risk 2.

screenshot1.jpg

screenshot2.jpg

rgds

Jim

Labels (1)
19 Replies
sunny_talwar
MVP
MVP

You need to start providing sample Jim. Here look at these threads which will tell you why we need a sample and will help guide you in preparing a sample and loading it here:

QlikCommunity Tip: How to get answers to your post?

Preparing examples for Upload - Reduction and Data Scrambling

Uploading a Sample

Help us help you better and faster.

jim_chan
Specialist
Specialist
Author

bro, is not that i dowan to provide.  i can reduce i can scramble. but how to hide the data model? i can upload the qvw here, but i need to hide the datamodel.

sunny_talwar
MVP
MVP

I have heard about confidential data, but never heard about confidential data model

jim_chan
Specialist
Specialist
Author

ookokkkkkkk....

this is the sample bro. it is using your expression.

rgds

jim

sunny_talwar
MVP
MVP

What are you expecting to see with and without selections?

sunny_talwar
MVP
MVP

See if this is what you want

=Count(DISTINCT {<risk_item_id = e({<risk_item_id = {"=Count({1<batch_year = {'<$(=Max(batch_year))'}>} risk_item_id) > 0"}>})>} risk_item_id)

No selection

Capture.PNG

NOFEYT selected

Capture.PNG

APOMRPY Selected

Capture.PNG

CQBNSGZQ

Capture.PNG

sunny_talwar
MVP
MVP

If the requirement is met, you can go ahead and remove your attachment

jim_chan
Specialist
Specialist
Author

how to remove it bro ?

sunny_talwar
MVP
MVP

‌You can go into Editing your response and from there you can remove your attachment by clicking on the x next to your attachment file.

IMG_0190.PNG