Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Find new subscripers or subscripers lost, previous(), Churn

Hi,

I am trying to find new subscribers per day and subscribers lost per day.  I have been using previous() do it. I think I have found a way to find new customers but I cannot crack the issue with lost subscribers.  The data is basically as

DagsStads, KennitalaRetthafa

2015-02-01, 1 Start of subscription

2015-02-02, 1

..

..

..

..

2015-02-28, 1 Still a subscriber.

2015-02-01, 2 Start of subscription

2015-02-01, 2

..

2015-02-10, 2 - Lost customer

..

So the min(date) is the start date of the subscription , so I would like to mark him as new, the last max(date) is the day he stops, but if the max(date) is last day of month he is still a customer.

Here is my code as is, any hints would be greatly appreciated. On top of this I was thinking of calculating subscriper churn rate.

MaxDags:
LOAD maxString(DagsStads) as MaxDags,
MinString(DagsStads) as MinDags

FROM
(qvd);
 
LET vMaxDags = PEEK('MaxDags');
LET vMinDags = Peek('MinDags');
DROP TABLE MaxDags;

Regards Birkir


[SubsData]:
LOAD DagsStads,
      KennitalaRetthafa
FROM
(qvd);


[NewSubs]:
LOAD DagsStads,
      KennitalaRetthafa,
      if(Previous(KennitalaRetthafa) = KennitalaRetthafa and Previous(DagsStads) <> $(vMaxDags), 'Áskrift','Nýr') as Previ
     Resident SubsData
Order by KennitalaRetthafa, DagsStads;

DROP Table SubsData;

11 Replies
Highlighted
Creator III
Creator III

Re: Find new subscripers or subscripers lost, previous(), Churn

any way you can make a test QVW with test data?

Highlighted
Contributor III
Contributor III

Re: Find new subscripers or subscripers lost, previous(), Churn

Hi Boris,

Yes just added a zip file.

Thanks regards

Birkir

Highlighted
Creator III
Creator III

Re: Find new subscripers or subscripers lost, previous(), Churn

oh wow Icelandic:)

I think you are on the right track with your code. I remember I had issues before with ORDER BY and previous peek functions in the same load statement. Try to do ORDER BY first and then resident load ordered table and use previous function at that point - so you would do ORDER BY on SubsData table not for NewSubs.

Also why your max/min dates are global and not subscriber related?

Highlighted
Contributor III
Contributor III

Re: Find new subscripers or subscripers lost, previous(), Churn

Hi Boris,

Yes sorry for the Icelandic, I was getting a bad from my wife when I was replying

I will try the Order By trick you mentioned.

Yes regarding the max/min dates, I thought about having it on a per subscriber base, how would you do that?

Regards

Birkir

Highlighted
Creator III
Creator III

Re: Find new subscripers or subscripers lost, previous(), Churn

there are many ways...you could use RANK function and GROUP BY for example to rank group of rows that would relate to one SubscriberID.

OR you can just get away with GROUP BY on a resident table and storing min/max date in the third table by subscriberID and join it back to your main table.

Even with your test QVD (thanks for uploading it), it is a bit tough to understand your data and what you are trying to do.

Highlighted
Contributor III
Contributor III

Re: Find new subscripers or subscripers lost, previous(), Churn

Hi,

I created a new file, this time not Icelandic added a qvw file. So maybe this will help to explain what I am trying to achieve.

So this is more or less the result I am after, but I am kind of lost in how to get there.  The is to look at the first date in a snapshot table and mark a customer as new, if found in previous which is not new then it is an established subscription. If previous subsId changes the previous subscriber quit that day.

Again all hints are appreciated.

Boris thanks again for all your help.

Regards

Birkir

  • ResultSubs.png
Highlighted
Creator III
Creator III

Re: Find new subscripers or subscripers lost, previous(), Churn

you forgot to attach your QVD. also in your sample data, only New subscribers are present so there is no Quit or Subscription.

Highlighted
Contributor III
Contributor III

Re: Find new subscripers or subscripers lost, previous(), Churn

Hi Boris,

Sorry for this my mistake, I added the QVD file and a bit more data, this customer 2212862789 stops his subscription on the 2014-03-11 and starts again on the 2015-01-26.

I'm still a puzzled with this,

Regards

Birkir

Highlighted
Creator III
Creator III

Re: Find new subscripers or subscripers lost, previous(), Churn

your QVD has only two fields