Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sum of sales per customer of a selected band

Hi Guys,

Trying to sum the total sales of customers with selected bands

eg.

band1 total sales from $0 to $10,000

band2 total sales from $10001 to $20,000

etc.. etc..

I've tried the following but getting 0 results.

sum(if(aggr(sum(sales),CustomerID)>0<10000,aggr(sum(sales),CustomerID),0))

1 Solution

Accepted Solutions
Not applicable
Author

Figured it out.

Add the following calculated dimension, then add expressions accordingly

if(aggr(sum(Sales),CustomerID)>0,if(aggr(sum(SALES),CustomerID)<50000,'D'

,if(aggr(sum(SALES),CustomerID)>50001,if(aggr(sum(SALES),CustomerID)<200000,'C'

,if(aggr(sum(SALES),CustomerID)>200000,if(aggr(sum(SALES),CustomerID)<500000,'B'

,if(aggr(sum(SALES),CustomerID)>500001,'A')))))))

View solution in original post

4 Replies
sujeetsingh
Master III
Master III

Why dont u use simple expression with nested if

if(brandname=''aaa'' ,sum(),sum())

Gysbert_Wassenaar

Try a calculated dimension Class(aggr(sum(sales),CustomerID),10000) and sum(sales) as expression.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi, Thanks for that.

That has helped a lot however it has listed 12 random sales brackets for me.

I specially want to specify 5 which are

>0 <50,000

>50,001 < 100,000

>100,001 < 250,000

>250,001 <500,000

>500,000

Thanks

Not applicable
Author

Figured it out.

Add the following calculated dimension, then add expressions accordingly

if(aggr(sum(Sales),CustomerID)>0,if(aggr(sum(SALES),CustomerID)<50000,'D'

,if(aggr(sum(SALES),CustomerID)>50001,if(aggr(sum(SALES),CustomerID)<200000,'C'

,if(aggr(sum(SALES),CustomerID)>200000,if(aggr(sum(SALES),CustomerID)<500000,'B'

,if(aggr(sum(SALES),CustomerID)>500001,'A')))))))