Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Make dynamic groups and count elements in each group

Hello,

I have a QlikView riddle, that prevent me to sleep.

Lets imagine I have products sorted by a main category ("Eatable", "Transport"), and a sub category ("Fruit", "Vegetable" for the "Eatable" and "Bike", "Car" for the "Transport").

error loading image

I have a price for each product, and a "sales" table that give me the number of item sold.

With the formula

sum(aggr(Sum(Qtt) * only(Price), Prod))


I have the sum of the sales, and even if I collapse my dimension, I have the right sum.

Now, the riddle... 🙂

I want to make a classification between my products : the products having a sum of sales equal to "0", the products having a sum of sales > 0 and < 50, and the products having a sum of sales >= 50. The classification is labeled "none", "few", and "many".

error loading image

Now, I would like to make a pie chart displaying for each "MainCateg" or "Categ" the count of products labeled "none", "few", "many".

If I'm on the "MainCateg" "Eatable", I want to see a pie with :
- 1 "none"
- 2 "few"
- 1 "many"

To do that, I have to make a calculated dimension that gives "none" / "few" / "many".

I've tried many things, but I don't have a result that allows me to drill down from "MainCateg" to "Prod".

Do you have any idea how to do that ?

I attached the QVW file I work on.

3 Replies
Not applicable
Author

I still don't have the drill down feature I want, but I managed to have the dynamic dimension.

vupen
Partner - Creator
Partner - Creator

Here is the soloution to your scenario:

Create an INLINE table as below and another table to join using Interval Match


SalesRange:
LOAD * INLINE
[
RangeText;RangeLow;RangeHigh
None;0,0
Few;1,45
Many;46,10000
] (delimiter is ';')
;

JOIN(SalesRange) IntervalMatch(Sales) Load RangeLow, RangeHigh Resident SalesRange ORDER BY RangeLow ASC;


In the above code, I assume 'Sales' as the column name for Sales in your base table.

d_pranskus
Partner - Creator III
Partner - Creator III

Hi

Just add the calculated dimension to the Dimension Group using Button "Add Expression".

Cheers

Darius