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: 
ajsjoshua
Specialist
Specialist

Revisit calculation

Dear all,

I want to calculate the count of customers who revisited again.In this case customerid 1 purchased 3 products on same date but on different time i dont want to calculate revisits in same day.Revisit should be based on different date.

My output should be

count of revisit is 2.(only customerid 1 and 2 revisited again)


PFA for app

   

customeridDateProductrevenue
11/1/2017dfg4000
11/1/2017ass3000
11/1/2017rer1000
2        23/1/2017wes6000
2        25/1/2017tre2000
34/2/2017ewe5000
45/2/2017asa7000
17/2/2017adas10000
1 Solution

Accepted Solutions
sunny_talwar

Try this

=Count({<customerid *= {"*"}>}DISTINCT customerid&Date) - Count(DISTINCT customerid)

View solution in original post

13 Replies
sunny_talwar

For a solution which doesn't involve changes in the script... try this

=Count(DISTINCT Aggr(If(Count(TOTAL <customerid>DISTINCT customerid&Date) >= 2, customerid), customerid, Date))

If you can make changes in the script... then try to create a new field like this

AutoNumber(customerid&Date) as KeyField

and then something like this

=Count(DISTINCT {<KeyField = {"=Count(TOTAL <customerid>DISTINCT customerid&Date) >= 2"}>} customerid)

ajsjoshua
Specialist
Specialist
Author

Dear Sunny,

Thank u for ur reply.

i have added another visit for customer id 2 when we select customer id 2 it gives visits as only 1 but it should  be 2.

PFA for app.

  

customeridDateProductrevenue
11/1/2017dfg4000
11/1/2017ass3000
11/1/2017rer1000
223/1/2017wes6000
225/1/2017tre2000
34/2/2017ewe5000
45/2/2017asa7000
17/2/2017adas10000
226/1/2017wer2330

Regards,

Joshua. !

ajsjoshua
Specialist
Specialist
Author

Dear Sunny,

I tried it in script also its not working.

Regards,

Joshua.

sunny_talwar

What is the logic to see 2? I mean if you have selected only one customer, shouldn't you be seeing 1?

ajsjoshua
Specialist
Specialist
Author

Hi Sunny,

If i select one customer i want to see how many times he revisited based on date.In below customerid 1 revisited one time and customerid 2 revisited 2 times.

customeridDateProductrevenue
11/1/2017dfg4000
11/1/2017ass3000
11/1/2017rer1000
223/1/2017wes6000
225/1/2017tre2000
34/2/2017ewe5000
45/2/2017asa7000
17/2/2017adas10000
226/1/2017wer2330
sunny_talwar

Try this

=Count({<customerid *= {"*"}>}DISTINCT customerid&Date) - Count(DISTINCT customerid)

ajsjoshua
Specialist
Specialist
Author

Dear Sunny ,

Thank you.

for calculating revisit% can we use this expression

=(Count({<HISNo *= {"*"}>}DISTINCT HISNo&Date) - Count(DISTINCT HISNo))

Count(DISTINCT HISNo)

sunny_talwar

What is the expected output based on the sample above when no selection is made and when 1 or 2 is selected?

ajsjoshua
Specialist
Specialist
Author

Dear Sunny,

Yeah with no selections.