Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sales Price Bands

Hi,

I've been away from QV for 3 years and am very rusty - would love some guidance on what I am trying to accomplish.

I have a sales database that contains a lot of transaction.

I would like to create a histogram of the numbers of customers (by aggregating their transactions) for specified price bands.  For example:

Sales     Customer Count

$0-20k           3

$20-$40k       7

$40-$60k       3

etc.

I'm fine with creating a table first to get te rust off and then making a chart out of it. 

Thanks in advance,

Rick

2 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Dear Rick,

     You can do one thing, you can create this table in script itself.

     Something like this.

     LOAD Distinct

                Item,

                Customer,

                if(Sum(Sales)>=0 and Sum(Sales)<=20,'$0-20K',

                     if(Sum(Sales)>=21 and Sum(Sales)<=40,'$21-40K',

                         ................) as Bucket.

     From Xyz group by Item,Customer;

     Now you can create a chart and then count the customers by Bucket.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
sbaldwin
Partner - Creator III
Partner - Creator III

Hi, you could use the class function either in your load script or as a calculated dimension, that way you won't have to do a nested if fir every sales group eg:

  LOAD Distinct

                Item,

                Customer,

                  Sales

                class(Sales,10000,'$') as Bucket.

     From Xyz  ;

Thanks

Steve