Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ZimaBlue
Creator
Creator

pie chart with count with an integrated condition

Hello!

I need a slightly complicated chart. I want to build a pie chart with count with an integrated condition instead of a field. 

My condition is:

if orders_sum is more than 7000, then 'target customer', if more than 3000 then 'on the border', otherwise 'not targeted'

Further, based on this condition, i want the pie chart to show the number of customers for each of the resulting categories: target, on the border, not targeted. I know that it is possible to load field in the script, but this is not the best option for our data, so i would like to build this by calculations in the chart.

So I need something like aggr( count( <{sum(order_cost)={>7000} }> user_id), user_id) but all the options i've tried give an error or null

Thanks for any tips!

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Add a Calculated Dimension as below

 

= AGGR( if(sum(order_cost)>7000,'target customer'
,if(sum(order_cost)>3000,'on the border' ,'not targeted' ) ) , user_id)

 

Add Measure as below

=count(distinct user_id)

 

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

View solution in original post

2 Replies
abhijitnalekar
Specialist II
Specialist II

Hi @ZimaBlue ,

Why don't you create a master dimension which you can use in your pie chart?  

Regards,
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!
vinieme12
Champion III
Champion III

Add a Calculated Dimension as below

 

= AGGR( if(sum(order_cost)>7000,'target customer'
,if(sum(order_cost)>3000,'on the border' ,'not targeted' ) ) , user_id)

 

Add Measure as below

=count(distinct user_id)

 

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