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: 
twanqlik
Creator II
Creator II

Calculate unsubscribe status

I want to check when a customer unsubscribes. 

Input table:

IDMONTHSubscribed status
12021-05Yes
12021-04No
12021-03No
12021-02Yes
12021-01Yes
12020-12No
12020-11Yes
12020-10Yes

 

Expected result:

IDMONTHSubscribed status
12021-05 
12021-04 
12021-03Unsubscribed
12021-02 
12021-01 
12020-12Unsubscribed
12020-11 
12020-10 

 

Any tips on how to accomplish this? 

The ordering of the months is of course important.

In the expected output table are only 2 Unsubscribed statuses, not 3.
The customer unsubscribed in March 2021, and was still unsubscribed in April 2021.
The action was performed in March, and that i want to visualize.  

 

 

1 Solution

Accepted Solutions
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @twanqlik, I think you can accomplish this with Previous() function:

NewTable:

Load

   ID,

   MONTH,

   If(ID = Previous(ID) And Previous([Suscribed status]) = 'Yes' And [Suscribed status] = 'No', 'Unsubscribed')  AS [Suscribed status]

Resident InputTable   // or your datasource

Order by ID, MONTH;

 

JG

View solution in original post

1 Reply
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @twanqlik, I think you can accomplish this with Previous() function:

NewTable:

Load

   ID,

   MONTH,

   If(ID = Previous(ID) And Previous([Suscribed status]) = 'Yes' And [Suscribed status] = 'No', 'Unsubscribed')  AS [Suscribed status]

Resident InputTable   // or your datasource

Order by ID, MONTH;

 

JG