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

Count distinct where not Exist

Hello Everyone – I was hoping you can help me with how to get the below accomplished in Qlik Sense, I would really appreciate it, here is the example in its simplest form:

I’m getting a table from SQL that looks like this in Qlik:

FileNumber // ShipmentStatus

9500001 // Delivered

9500001// Tendered

9500001// Order_Released

9500002// Delivered

9500002// Tendered

9500002// Order_Released

9500003// Tendered

Now, if I try to count distinct FileNumber where ShipmentStatus = Tendered, I will get 3, great no issue, and also no issue if I account distinct any other ShipmentStatus.

But the issue is when I try to count distinct FileNumber where ShipmentStatus <> Tendered, I will get 2, although the right result should be zero. Same if I try to any other status but use the function <>. Basically Qlik count all the other FileNumber.

I hope I was able to explain.

Any feedback is highly appreciated.

Thanks in advance.

Labels (3)
1 Solution

Accepted Solutions
HugoRomeira_PT
Creator
Creator

Hello,

For frontend/visualization you can use the following logic:

count(distinct FileNumber) - Count(Distinct {<ShipmentStatus ={'Tendered'}>} FileNumber)

Basically you count all and then subtract the ones that have the status to be removed.

 

Hope it helps!

If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.

View solution in original post

3 Replies
HugoRomeira_PT
Creator
Creator

Hello,

For frontend/visualization you can use the following logic:

count(distinct FileNumber) - Count(Distinct {<ShipmentStatus ={'Tendered'}>} FileNumber)

Basically you count all and then subtract the ones that have the status to be removed.

 

Hope it helps!

If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.
MohammedHassan
Contributor
Contributor
Author

Thanks Hugo, that seems logical, will try. I appreciate  it.

vinieme12
Champion III
Champion III

Modified

Try below

=Count( {<Filenumber=e({<ShipmentStatus ={'Tendered'}>} FileNumber) >} Distinct Filenumber)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.