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

Any easy way to create an uneven class() calculated dimension?

I'm thinking the only easy way to do this is precalc via load script, but just in case anyone has a simple solution: I want to use an aggregate as a calculated dimension in a crosstab, e.g.

=aggr(sum(value),CustomerID)

I can wrap this into a class to get me some groups as the dimension, e.g.

=class(aggr(sum(value),CustomerID),5)

Which will give me equal size divisions of my sum(value) expression, in this case 5

But what if I want an uneven class, e.g.

0-5

6-10

11-50

51-100

any ideas?

Thanks

3 Replies
johnw
Champion III
Champion III

It might be slow, but a series of IFs? Not sure if I'm doing this exactly right:

aggr(only(if(sum(value)<= 5,dual('0-5' , 5)
,if(sum(value)<= 10,dual('6-10' , 10)
,if(sum(value)<= 50,dual('11-50' , 50)
,if(sum(value)<=100,dual('51-100',100)
,dual('101+' ,999)))))),CustomerID)

hector
Specialist
Specialist

I dont think that the label can be change, cause is calculated by the class() function, but it writes"<=" and "<" so, there are not closed intervals

=class(Aggr(Sum(value),CustomerID),5) Count (CustomerID)
6
5 <= x < 101
10 <= x < 151
15 <= x < 201
25 <= x < 301
0 <= x < 5

2



c ya!

wizardo
Creator III
Creator III

I am sorry that if this is out of context,

but is this solution the only way to do an uneven class?

I have a case where i need to make it also combined with a slowly changing dimension (i need to keep track of when the classes changed) but that's another issue

i think basically what is needed is someway to do (interval match) in layout

anyways hope im not disturbing

(i hope you did find another solution since 2009)