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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Gabri
Contributor III
Contributor III

Repetitive customer by year

Hello community,

I have a question with a KPI function and I would like to know if you can help me.

I want to know how many clients, specified one year, have bought us in the previous year, for example:

CLINAMEYEARINVOICE NUMAMOUNT
CA2019540
CA2019440
CA2019322
CA2019210
CA2019115
CA2018110
CBb2018220
CBb2018120
CCcc2019228
CCcc2019120
CCcc2018110
CCcc2017110
CDddd2019150

 

YEAR    2019    
        
TOTAL CLIENTS (2019)    3  'solved'
TOTAL INVOICES (2019)   8    'solved'
TOTAL AMOUNT   (2019)  225    'solved'
        
Repetitive customer (2019)    2    'I don't know how to get this value'

 

Thanks in advance,

 

Labels (1)
12 Replies
Gabri
Contributor III
Contributor III
Author

Now I'm trying diferent options, another example with a table, also need the (sum) of this 2 fiels...

 

 

Sin título.png

 

uacg0009
Partner - Specialist
Partner - Specialist

Hi Gabri,

Please try below expression, it works in my desktop:

=Sum(if(aggr(NODISTINCT sum({<YEAR = {"$(=Only(YEAR) - 1)"}>}AMOUNT) > 0,CLINAME),AMOUNT))

Aiolos Zhao

Gabri
Contributor III
Contributor III
Author

Hi, I want to add another field in this exercise, for example if I filter by YEAR=2019 this table

CLINAMEYEAR AMOUNT
CA2019 40
CA2019 40
CA2019 22
CA2019 10
CA2019 15
CA2018 10
CBb2018 20
CBb2018 20
CCcc2019 28
CCcc2019 20
CCcc2018 10
CCcc2017 10
CDddd2019 50

 

HOW MANY CUSTOMER ARE REPETITIVE ON FILTERED YEAR? 2 --> (CA, CCcc)

=Count(DISTINCT {$<YEAR = {"$(=Only(YEAR) - 1)"}>} if(aggr(sum(AMOUNT) > 0,CLINAME),CLINAME))

TOTAL AMOUNT OF REPETITIVE CUSTOMERS ON FILTERED YEAR. 175 --> (CA=127 + CCcc=48)

=Sum(if(aggr(NODISTINCT sum({<YEAR = {"$(=Only(YEAR) - 1)"}>}AMOUNT) > 0,CLINAME),AMOUNT))

 TOTAL INVOICES OF REPETITIVE CUSTOMERS ON FILTERED YEAR? 7 --> (CA=5, CCcc=2)

??? my option...

=Count(if(aggr(NODISTINCT sum({<YEAR= {"$(=Only(YEAR) - 1)"}>}AMOUNT) > 0,CLINAME),CLINAME))

 

 

Thanks in advance!