Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Faiz
Contributor
Contributor

Count distinct products with condition

 

I want to count of distinct products whose sale is more than 1 million. How can I write below expression in Qlik Sense?

SELECT 
Count(distinct c.[Product])
FROM Sales a
INNER JOIN Item c ON a.[Item No.]=c.[Item No.]
Having Sum(a.Sales)>1000000

2 Replies
GaryGiles
Specialist
Specialist

In Qlik Sense you use set analysis to apply a condition like the Having clausing in SQL.

count({$<[Product]={"=sum(Sales)>1000000"}>} Distinct Product)

 

Faiz
Contributor
Contributor
Author

Thanks. This worked for me:

Count({< [Product] ={"=Sum(SALES)>1000000"}>} Distinct [Product])