Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Rogeriotigre
Contributor
Contributor

Count based on accumulated %

How to count the number of customers who have an accumulated % of 30%, 50% and 100%, as per the exampleCapturar 0305.PNG

Labels (1)
1 Reply
rubenmarin

Hi, solution attached.

I created a variable vPorAcumVenda to store the expression that calculates the accumulation, just to help with construction and easy readiness of expressions.

RangeSum(Above(Sum(VENDA)/Sum(TOTAL VENDA),0, RowNo(TOTAL)))

And used this expression in Aggr with sorting parameters so it simulates the table by customer sorted by descendant sales.

Inside the aggr each column only counts the customer between the % values.

Sum(Aggr(If($(vPorAcumVenda)>0.3 and $(vPorAcumVenda)<=0.5, 1, 0),(COD_CLIENTE,(=Sum(VENDA),Desc))))

Also added a table to confirm the customers counted in each column.

Concat(Aggr(If($(vPorAcumVenda)>0.5, COD_CLIENTE),(COD_CLIENTE,(=Sum(VENDA),Desc))),'-')