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: 
surajap123
Creator III
Creator III

distinct count-exclude nulls or blanks or zero

Hi Experts,

I have the below dataset and I want to show distinct count of Products(but exclude products where the exp field has null, blank or 0 values)

Data-->

Category Product exp sales

cat1 A 34 100

cat1 A 20

cat1 B 100

cat1 C 10 50

cat1 D 0 50

In straight table i am using Category as dimension and below expression

Count({<exp =- {"=IsNull(exp)","=len(exp)",0}>} DISTINCT Product)  //not working

Please help

1 Solution

Accepted Solutions
sunny_talwar

How about this

Count({<Product = {"=Sum(exp) = 0"}>} DISTINCT Product)


Capture.PNG

View solution in original post

6 Replies
Anil_Babu_Samineni

This?

Count({<exp -= {"=IsNull(exp)","=len(exp)=0"}>} DISTINCT Product)  //not working

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
surajap123
Creator III
Creator III
Author

The expression is returning 3. As you can see only 2 distinct products satisfies the condition.

Capture.JPG

prat1507
Specialist
Specialist

Maybe this

Count({<exp -= {"=IsNull(exp)","=len(exp)=0","0"}>} DISTINCT Product)  //not working

sunny_talwar

How about this

Count({<Product = {"=Sum(exp) = 0"}>} DISTINCT Product)


Capture.PNG

Anil_Babu_Samineni

What are you getting when you use these?

Count({<exp -= {'-','0'}>} sales)

Count({<exp = {"=Sum(exp) > 0"}>} sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
surajap123
Creator III
Creator III
Author

Thanks sunny