Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Jimmy_F
Contributor
Contributor

count distinct with dynamic condition

Hello everyone,

I'm a beginner on Qlik Sense, and I'm stuck with the issue described below.

 

the sample data as below:

Year_QuarterYear_MonthProductSalesClass
2021Q1202101A100 
2021Q1202101B40 
2021Q1202101C120 
2021Q1202102A30 
2021Q1202102B20 

the "class" field is a master item calculated by below formula:

if sum(sales) in each product >=50 then "good"

if sum(sales) in each product <50 then "bad"

 

and I need a bar chart to count the number of each class in different time level(month or quarter)

the table result as below(by month )

Year_QuarterYear_MonthProductSalesClass
2021Q1202101A100good
2021Q1202101B40bad
2021Q1202101C120good
2021Q1202102A30bad
2021Q1202102B20bad

and the dashboard result should be as below:

Jimmy_F_0-1627618509194.png

 

and the table result as below(by quarter )

Year_QuarterProductSalesClass
2021Q1A100+30=130good
2021Q1B40+20=60good
2021Q1C120good

and the dashboard result should be as below:

Jimmy_F_1-1627618999435.png

 

How can I do for this dashboard?

thanks very much!

 

 

1 Solution

Accepted Solutions
menta
Partner - Creator II
Partner - Creator II

Use aggr and use it as dimension

Aggr(If(Sum(Sales)>50,'Good','Bad')),Product,Year-Month)

View solution in original post

2 Replies
menta
Partner - Creator II
Partner - Creator II

Use aggr and use it as dimension

Aggr(If(Sum(Sales)>50,'Good','Bad')),Product,Year-Month)

Jimmy_F
Contributor
Contributor
Author

I solved this problem by using aggr function, thank you very much!