Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to count the number of customers who have an accumulated % of 30%, 50% and 100%, as per the example
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))),'-')