Qlik Community

QlikView Documents

Documents for QlikView related information.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.

ABC Analysis to set and remember classification at runtime


ABC Analysis to set and remember classification at runtime

This is a very user-convenient and performant way to make A/B/C analyses with QlikView, since the classification of the A's, B's, and C's is stored at the moment when the user wants and remain valid until the next time the user hits a button. In other words, the classification is made relative to a current selection but the A-, B-, C-assignments but also remain "sticky" to the dimension. The "ABC-Class" appears to the user like an ordinary dimension, which is presented in a list box, used for coloring, counting etc.

>> check out Video1 (For Users) to see this in action


I have seen two other approaches of ABC analysis, which do not help a user very much:

  • A fixed classification done during script execution ....
  • A relative classification which keeps re-calulating permanently ...

Both are not optimal. The first one will not react to a more narrow selection made by the user. The A/B/C are static (which may make sense from a generic point of view but not for the business user). The latter approach does not remember the classification and cannot adopt the GUI according to it. Once the user selects the A, the frontend shows "new A's", namely the A's of the A's, which makes no sense.


This is solved with the help of three alternate states and Pareto-Select action. The states remember the A, AB, and ABC selection from now on, even when all other selections in the main state change. Therefore, the classification is "stored" until the next recalculation of ABC.

>> check out SWF-video 2 for the techies

Related articles
Users can map/group dimensions at run-time!



Labels (1)
Not applicable

Great work!  Excellent as always!

New Contributor II

Very cool indeed! Thanks for sharing this!!

Contributor III

Hi Christof,

Thanks a lot for this elegant solution, I find it very helpful.

I have a Question though;

It seems that the Pareto select always populate Group A even if it's percentage is higher than

the lower bound. For example, in your qvw file, when I choose 20% at A Limit, I will get Vendor Anton in group A even though his propotional volume is 21%. Is there a way to update the calc in a way that Group A will include Only vendors who are below 20% (Meaning that A group will be empty in this case )?



You are right, there is no immediate solution I can offer. The PARETO SELECT action always selects at least the first sorted member, even when it is already above the threshold. I can overrule this by checking "Select Complement" in the PARETO SELECT Action settings and the put a SELECT EXCLUDED action after. Then the A set would be empty, which means "no selection". If this is the case, the Set Analysis thinks, that all members belong to A. No selection, with the "eyes of a set analysis" look exactly like having selected all.

To achieve this, I would need a function like "GetCurrentSelections()" with an argument to look into a specific state. This function does not exist. GetCurrentSelections always looks into the main state ... that is missing in my opinion.


Contributor III

Right, Current selection is only for main state... I Will try to find other solutions and will update if I find.

Thanks for your reply.

Not applicable

Great solution Chrostof, thanks a lot. This was the perfect, light and easy to use solution I was looking for... until I found one of these small QV bugs that almost destroys it for me.

I just realized that the "copy state contents action" doesn't work when you have section access, and you know - in a corporate environment it is rare to have a bigger app without it. I am trying to find a workaround, with no success until now. Any ideas?


You've stated a buggy behaviour, indeed. Have you or someone raised a support case for this? In fact, the "Copy States" and "Swap States" commands will both work even when set analysis is used in the document, but all the elements on the screen using the alternate state will stop updating (they freeze without notice). To get them work (until the next Copy States action) turn on/off Webview or cut all objects and paste them again. Both measures will "recover" those objects. However, this must be looked into from support.

Not applicable

No, I still haven't raised it and didn't intend to, but I will contact support... honestly I haven't contacted the support for almost 2 years since we had a very big project where we found lots of QV bugs, but had very bad experience with support (this is a long story). Maybe things have changed.. will see. Thanks for furhter investigating this behavior. In the mean time, after spending almost a day trying many different and exotic approaches, I thnik I found a really simple workaround. Just removed the "Copy States" actions and used $ in the expression: will be Sum({1}Volume) in your example. Then the 3rd state ABC becomes oboslete as you cannot copy the other selections in it. Instead you should substitute it with $ in the dimension: Aggr(If(Len(Only({A}Vendor)), 'A', If(Len(Only({AB}Vendor)), 'B', If(Len(Only({$}Vendor)),'C'))), Vendor).

While banging my head looking at different workarounds, I was almost there with one of them when I found another QV feature that made me quite unhappy (I guess this is working as designed, but puts a lot of limitations): QV actions in a button/other object get executed all simultaneously - ordering them means nothing. Hvaing the option to choose whether you want synchronous/asynchronous excecution will be a grear benefit. I think of postiong this as an idea.

Not applicable


After having a similar problem

And checked the solutions that you raise here.

I have a problem, the application works as normal before section access

And when i start the " Initial data reduction based on section access".

the categories are 20% / 50% / 80% and more has not arranged correctly.

I deleted the "Copy State" and changed  the Last one  (ABCD) to $

Do you have an idea to solve? Please.

Thank you

Not applicable

Hello Ori Tal,

How to make expression with "Volume %":

Version history
Revision #:
1 of 1
Last update:
‎03-14-2014 03:50 AM
Updated by: