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: 
Manav_1988
Contributor
Contributor

Display values basis on the custom buckets

Hi All, I want to display values on the basis of a custom bucket in a bar chart. 

e.g. my custom buckets are

1. >=5000 and <50000

2. >=50000 and <200000

3. >=200000 and <500000

4. >= 500000

Now, I want to display Count of Sales total based products and it location. 

Consider the below table:

Product Location Sales
A AA 2000
A AB 10000
A AC 12000
B BA 5000
B BB 200000
B BC 50000
C CA 12000
C CB 13000
D DA 500000
D DB 5000000
D DC 5000000

 

As a result it'll display 

4 bucket's on the Y axis and Count of the sum of Sales in the related bucket.

Result 

Labels (1)
4 Replies
SabrinaV
Partner - Contributor
Partner - Contributor

Hello,

 

I think you can use the class function.

Please see the link https://help.qlik.com/en-US/sense/February2023/Subsystems/Hub/Content/Sense_Hub/Scripting/Conditiona...

Or
MVP
MVP

As is generally the case with uneven-sized buckets, the easiest way to approach this is nested if() statements.

If(Sales > 5000 AND Sales < 50000, 'Bucket 1', If(Sales < 200000, 'Bucket 2', etc))

If you  need this done with an aggregation, you would use aggr(Sum(Sales),Dim1, Dim2) instead of the simple Sales.

Manav_1988
Contributor
Contributor
Author

Hi,

Thanks. I tried but Class function won't work here as It's a custom bucket scenario.

Manav_1988
Contributor
Contributor
Author

Hi,

Thanks for your message. I tried the same way as you mentioned but it is not working. adding all the value for a single bucket.