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: 
johnnyjohn
Creator
Creator

Create given number of buckets from a measure

Hello, I have the measure below.

Sum(n0_is_at_mid_bps * n0_value_EUR) / Sum(n0_value_EUR)

What is the best way to create, say 20 buckets for the this measure, dynamically as an expression, not in the load script.

The parameter to the class function doesn't allow this currently. 

Thanks

Labels (2)
11 Replies
vincent_ardiet_
Specialist
Specialist

Ok, I see, you are applying this on a field, not a measure and to be used as a dimension.
Aggregation functions are not allowed here, however, the result of your computation is a constant, so you can use the variable expansion syntax.
Like this : 
CLASS(
n0_is_at_mid_bps,
$(=
CEIL((FABS(Min(n0_is_at_mid_bps)) + FABS(Max(n0_is_at_mid_bps))) / 20))
)

johnnyjohn
Creator
Creator
Author

Lovely stuff, thank you - learn something new everyday!