Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bazzaonline
Creator
Creator

Creating a stacked bar graph and bandings

I need to draw a chart which shows by month, the number of customer that spent between,

0

0-1000

1000-3000

3000 plus.

However I dont have the banded groups, just the amount the spent.  For example I want someone that spent 1005 to be banded in the 1000-3000 band and then display a stacked bar from counting the number of customers in each.  PLEASE HELP

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

A calculated dimension will help as below. 

if (  aggr(sum(Sales),[Customer}) = 0 , '0',

     if (   aggr(sum(Sales),[Customer})  >0 and aggr(sum(Sales),[Customer})  <=1000, '0-1000,

          if( aggr(sum(Sales),[Customer})  >1000 and aggr(sum(Sales),[Customer})  <=3000, '1001-3000',

                if( aggr(sum(Sales),[Customer})  >3000,'3000+')

          )

     )

)

Then create a count( distinct [Customer]) as your expression.

View solution in original post

3 Replies
JonnyPoole
Employee
Employee

A calculated dimension will help as below. 

if (  aggr(sum(Sales),[Customer}) = 0 , '0',

     if (   aggr(sum(Sales),[Customer})  >0 and aggr(sum(Sales),[Customer})  <=1000, '0-1000,

          if( aggr(sum(Sales),[Customer})  >1000 and aggr(sum(Sales),[Customer})  <=3000, '1001-3000',

                if( aggr(sum(Sales),[Customer})  >3000,'3000+')

          )

     )

)

Then create a count( distinct [Customer]) as your expression.

bazzaonline
Creator
Creator
Author

Brilliant, just Brilliant.  Confused me a little as think the } need to be ] but that you very much!

Just need to work out how to change the order they appear on the chart, for some reason its 3000, then 0, 0 -1000, 1000-3000 but sure even I can eventually work that out!

JonnyPoole
Employee
Employee

NP - you can put a custom sort order using the same expression logic on the sort tab. Leverage 'by expression' on the sort tab.