Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count number of distinct TVLicense numbers that are used more than once

hi there.

Lets say I have a table showing TV license sale transactions.  I have 200 transactions and 20 distinct (unique) TV licenses, some of which were used more than once.

I've created a straight table that shows only TV licenses that were used more than 10 times in a given period.

TV License numberNo. of times usedCount distinct
3658606857501
0967560945371
5867698505281
5857676859151
4957676954111
20

How do I make the "Count distinct" total show a total of 5 instead of 20? I.e. I only want to know how many unique licenses were used more than 10 times, NOT total number of unique licenses.

Hope you can help!

18 Replies
Chanty4u
MVP
MVP

use rowno()

swuehl
MVP
MVP

Try something like

=Count({<License = {"=Count(License)>10"}>} DISTINCT License)

HirisH_V7
Master
Master

Hi,

If Your data is like this,

LOAD * INLINE [

    TV License number, No. of times used

    3658606857, 50

    0967560945, 37

    5867698505, 28

    5857676859, 15

    4957676954, 11

    4323223232, 09

];

Then in table Expression,

IF([No. of times used]>10,Count(DISTINCT [TV License number]))

Conditional Count-204454.PNG

Hope this Helps,

PFA,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
HirisH_V7
Master
Master

Hi,

Try this,

IF([No. of times used]>10,Count(DISTINCT [TV License number])) 

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

Hi Hirish

I tried this but im not sure why it didn't work?

Not applicable
Author

Thanks Swuehl

This worked perfectly.

oknotsen
Master III
Master III

If that means your question is now answered, please flag the Correct Answer.

If not, please make clear what part of your question still needs answering.

May you live in interesting times!
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Because in your situation (License not being a dimension)  evaluating field [No of times used] outside of an aggregation function results in a NULL value because it delivers a large number of different values.

Moreover, you don't want to walk this path, as moving the IF inside the count() call - which would solve your issue - is very bad for performance. Set analysis is way better...

HirisH_V7
Master
Master

Hi,

Can you post your Sample.

Hirish

HirisH
“Aspire to Inspire before we Expire!”