Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
jim_chan
Contributor III

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

19 Replies

Re: Count expression incorrect

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

Re: Count expression incorrect

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.

Re: Count expression incorrect

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

jim_chan
Contributor III

Re: Count expression incorrect

ookokkkkkkk....

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

rgds

jim

Re: Count expression incorrect

What are you expecting to see with and without selections?

Re: Count expression incorrect

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

Re: Count expression incorrect

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

jim_chan
Contributor III

Re: Count expression incorrect

how to remove it bro ?

Re: Count expression incorrect

‌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