Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
muhammadraza
Partner - Creator
Partner - Creator

Get values belong to N% of total

Hi Guys,

I need to find only those values which belong (less of equal) to the 80% of total sorted from largest to smallest.

2-2-2015 2-31-37 PM.png

There is an option in Qlikview for the same (given below), but want solution in one aggr expression or without using Qlikview (built-in) functionality. Please guide.

2-2-2015 2-55-19 PM.png

Regards,

Muhammad Raza

8 Replies
Anonymous
Not applicable

Is there any particular reason behind not using qlikview built -in -functionality . because built in functions make our life easy.

muhammadraza
Partner - Creator
Partner - Creator
Author

yeah actually I have to use this aggr expression to build more charts on top of it, e.g. I will be showing groups products which belong to these values only and other (not part of 80%) items will not shown.

maxgro
MVP
MVP

PFA, hope it helps

muhammadraza
Partner - Creator
Partner - Creator
Author

Thanks for the reply, actually I need one (aggr) expression to get the list of values belong to the 80% (i dont need any chart to calculate these values I only need one expression), then I can use that expression to display sum of (80 %) values in a text box, I can also use this aggr expression as calculated dimension to get the relevant values. Hope you get my point.

muhammadraza
Partner - Creator
Partner - Creator
Author

Aggr(if (RangeSum(Above(total Sum(sales), 0, RowNo(TOTAL))) / Sum(total sales) <= 0.8, Sum(sales)),product), doesn't sort the values but getting the result when giving data in descending order.

Anonymous
Not applicable

Hi,

Make sure data is in descending order and try with below syntax:

aggr ( If ( Rangesum ( Above ( sum ( Sales ) ,0 , Rowno()-1 )) /  sum ( Total  Sales ) <= 0.8 , sum(Sales) , product)

Regards

Neetha

muhammadraza
Partner - Creator
Partner - Creator
Author

what if the data is also containing -ve values and I want to get 100% (all values in my result), in this case it will not work (it will not take all values into the result), see attached. Is there any solution for this.

2-8-2015 6-40-06 PM.png

Anonymous
Not applicable

Hi,

what about your expression is it taking negative values inclusive :

Aggr(if (RangeSum(Above(total Sum(sales), 0, RowNo(TOTAL))) / Sum(total sales) <= 0.8, Sum(sales)),product)

Regards

Neetha