Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to show cumulative classes?

Hello!

I'm trying to make a bar chart which shows the stock value (Y-axis) of inactive items. I would like to show the number of items which have been inactive for longer than two months, for longer than four months, for lomger than six months etc. This is a reverse cumulative chart, as items which have been inactive for longer than 4 months have been evidently also been inactive for 2 months.

I've managed to make a dimension which divides months of inactivity into classes of two months:

dual(replace(class(V_R_ITEM_MonthsSinceLastUse,2),'<= x <','-'),class(V_R_ITEM_MonthsSinceLastUse,2))

This dimension expresses the classes in my chart like this:

0-2

2-4

4-6

enz.

Although the maths do work, the  expression seems to suggest that items fall into restricted classes (i.e. "2-4") and that's not true. An item which has been inactive for 5 months falls into the same class as a item which has been inactive for 2 months (because this item has also been inactive for longer than two months), but the expresion of the classes my chart suggest that is does NOT belong to this class, as the class is expressed as "2-4" rather than ">2" or something. See attachements. The bars are fine; it's just the expression of classes along the X-axis which is not really what I'm looking for.

Does anyone now how to accomplish this?

Thanks!

Hugo

3 Replies
sunny_talwar

It seems that you don't really need Class function here and might be looking for accumulation. See if one of these approach helps:

The As-Of Table

Accumulations

jonathandienst
Partner - Champion III
Partner - Champion III

Num(Class(....)) converts the class statement by a number. I can't remember if it is the upper or lower bound of the class, but that gives you a starting point. Another option is to use SubField(Class(....), '<', -1) to get the upper bound and use this as the dimension value.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

That's what I was looking for!

Thank you both for your quick reply!