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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
A_M
Contributor
Contributor

Repeat Callers in 3 days & 7 days

Hi , 

I need to calculate the repeat callers who have called within 3 days of their first call as shown below.

A person will be considered for that date if he calls on that particular date only.

A_M_0-1694428094212.png

Similiarly for 7 days. 

Labels (1)
1 Reply
edwin
Master II
Master II

try this:

data:
load * inline [
customer, callDate
A, 1/1/2023
A, 1/3/2023
A, 1/4/2023
A, 1/5/2023
A, 1/9/2023
B, 2/1/2023
B, 2/7/2023
B, 2/9/2023
];


NoConcatenate
tmp:
load distinct * Resident data;

inner join (tmp)
load customer, callDate as repeatCallDate
Resident tmp;

NoConcatenate
repeatCalls:
load * 
Resident tmp
where repeatCallDate > callDate
and repeatCallDate <= callDate+3;

NoConcatenate
hasRepeatCalls:
load distinct customer, callDate, 'yes' as hasrepeatCalls Resident repeatCalls;

left join (data)
load * Resident hasRepeatCalls;

drop table tmp, repeatCalls, hasRepeatCalls;

 

repeatCalls table holds all repeat dates that qualify as repeat calls.  you can expand on this to implement the totals by just aggregating it.  from the sample data:

edwin_0-1694611680066.png