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: 
davenyrfajutag00
Partner - Contributor III
Partner - Contributor III

Cannot count the number of group A customers, group B customers and group C customers

Hi everyone,

I am working on creating an "ABC Analysis" in Qlik.

I have a raw table where, on the left side, I have the customers' names (which I’ve removed from the picture).

From left to right, the table includes the following columns:

  1. Sales amount
  2. % Incidence
  3. Cumulative % Incidence
  4. Group assignment (A, B, or C).

davenyrfajutag00_0-1739805053951.png

I have created the following formulas for the raw table:

  1. Customer ID                           
  2. Sum(Sales)                                
  3. Sum(Sales) / Sum(Total Sales)             
  4. RANGESUM(ABOVE(Sum(Sales) / Sum(Total Sales), 0, ROWNO(TOTAL)))
  5. IF(RANGESUM(ABOVE(Sum(Sales) / Sum(Total Sales), 0, ROWNO(TOTAL))) < 0.80, 'A', IF(RANGESUM(ABOVE(Sum(Sales) / Sum(Total Sales), 0, ROWNO(TOTAL))) < 0.95, 'B', 'C'))

Now, I would like to calculate the number of customers in each category (A, B, C). For example, in my case, there are 3 customers in category A, 6 in category B, and so on.

I want to perform this calculation in a KPI object, not within a row table object. I have already tried the following formula, but it doesn't work as expected:

COUNT(
AGGR(
IF(
RANGESUM(
ABOVE(
Sum(Sales) / Sum(Total Sales),
0, ROWNO(TOTAL)
) < 0.80,
'A',
CUSTOMER_ID
)
)

Thank you in advance for your help!

 

10 Replies
BrandonFontes
Partner - Contributor III
Partner - Contributor III

@davenyrfajutag00  Try this:

  • KPI A: Sum(Aggr(IF(RANGESUM(ABOVE(Soma(Vendas) / Soma(Total de Vendas), 0, ROWNO(TOTAL))) < 0,80, 1),[ID do Cliente]))
  • KPI B: Sum(Aggr(IF(RANGESUM(ABOVE(Soma(Vendas) / Soma(Total de Vendas), 0, ROWNO(TOTAL))) < 0,95, 1),[ID do Cliente]))
  • KPI C: Sum(Aggr(IF(RANGESUM(ABOVE(Soma(Vendas) / Soma(Total de Vendas), 0, ROWNO(TOTAL))) >= 0,95, 1),[ID do Cliente]))
Project Leader and Qlik Specialist at Work Avanti Solutions | www.avantisolucoes.com.br