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

Sales Value Buckets over time

Good afternoon.

I have a requirement to show bucketed Sales Values over time. I’ve created the buckets and can get each bucket to return the correct Sales Values. For example.

Buckets.PNG

For testing I’ve created example charts for most of the Buckets that are ‘hard code’. Although the example charts are showing data, they are not 100% correct – until you select the related Bucket.

Coded charts.PNG

When one actually selected a Bucket, the correct values show. For example, if you select the 5k-10k bucket the related chart returns the correct Values. All the values for each month per customer ranges between 5000 and 1000. 

5 to 10 selected.PNG

My question is, I don’t want a chart for each bucket. I need assistance with the expression in a Generic chart that shows the values when a Bucket is selected. I include the xlsx as well as the qvw file. If the explanation needs so clearing up, please feel free to reply. 

I would appreciate any guidance on this.

Thank you very much. 

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

Your buckets are script-generated against single-values but within the charts you are summing the values and this against several dimensions. This is a logical conflict.

I could imagine that an UI approach with a calculated dimension would be more suitable for your views. Maybe by integrating it directly in the table, like:

marcus_sommer_1-1700665893584.png

It's here simplified done with a class() around an aggr() which ensured that the buckets are calculated in regard to the period-fields and the customer. One customer is selected to show that its sales belong to different buckets.

You will need to play a bit with it to find what do you want to show - each single value, against the customer and/or the periods and/or further fields? Also with the buckets-sizes because class() itself applies only one size at the time whereby this size might be a variable and could then be easily changed. With some rangemin/rangemax wrapping the lower and upper outliers could be fetched and with some more pick(match()) and/or if-loops also the sizes itself whereby it would increase the complexity.

 

 

View solution in original post

3 Replies
marcus_sommer

Your buckets are script-generated against single-values but within the charts you are summing the values and this against several dimensions. This is a logical conflict.

I could imagine that an UI approach with a calculated dimension would be more suitable for your views. Maybe by integrating it directly in the table, like:

marcus_sommer_1-1700665893584.png

It's here simplified done with a class() around an aggr() which ensured that the buckets are calculated in regard to the period-fields and the customer. One customer is selected to show that its sales belong to different buckets.

You will need to play a bit with it to find what do you want to show - each single value, against the customer and/or the periods and/or further fields? Also with the buckets-sizes because class() itself applies only one size at the time whereby this size might be a variable and could then be easily changed. With some rangemin/rangemax wrapping the lower and upper outliers could be fetched and with some more pick(match()) and/or if-loops also the sizes itself whereby it would increase the complexity.

 

 

Aasir
Creator III
Creator III

Create a calculated dimention and use it in Generic chart
First:

BucketDimension:
LOAD
*,
ApplyMap('BucketMapping', Sales) as Bucket
INLINE [
Bucket, MinRange, MaxRange
1k-5k, 1000, 5000
5k-10k, 5001, 10000
10k-15k, 10001, 15000
// Add more buckets as needed
];

// Create a mapping table for the calculated dimension
BucketMapping:
MAPPING LOAD
Bucket,
Sales
INLINE [
1k-5k, 2500
5k-10k, 7500
10k-15k, 12500
// Add more mappings as needed
];

Then:
in Generics chart
Dimension: Bucket
Expression: Sum(Sales)

johngouws
Partner - Specialist
Partner - Specialist
Author

Thanks Marcus. 
It will need some fiddling, but I will be able to get it to work, well enough. 

Thanks.