Skip to main content
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. READ MORE

How to predict customer churn risk using Qlik AutoML and Qlik Application Automation

No ratings
Showing results for 
Search instead for 
Did you mean: 

How to predict customer churn risk using Qlik AutoML and Qlik Application Automation

Last Update:

Mar 1, 2024 3:25:50 AM

Updated By:


Created date:

Apr 4, 2022 11:34:13 AM


The automation built in this article won't be a perfect fit for every churn problem since every company has different customers and different data. The main goal of this article is to provide the right pointers and tips to build your own churn solution and to show what's possible when it comes to machine learning and automations.

This article explains how to build an automation that uses Qlik AutoML to predict the churn risk for customers. In this example, the following tools and systems are used:


  • Qlik Application Automation
  • Qlik Sense - to analyze churn risk in an app
  • Qlik AutoML - for training and deploying machine learning models
  • MySQL database - to feed customer data (inc. churn risk) to the Qlik Sense app
  • Salesforce CRM - as a source for customer records (Accounts)
  • Email - to alert stakeholders when churn risk is too high
  • Marketo - to auto-assign customers to marketing campaigns if their churn risk is too high

The following image provides an overview of how these systems are tied together by the automation: 



Before the automation can be built, a few steps need to be undertaken to ensure that all systems can work together.

1. Customer records

Export your CRM customer records to a CSV file. This should include old customers that have churned.

2. AutoML(Legacy) model

Use the dataset from the previous step to train a model in AutoML.
Once the model is trained, deploy it so it can be used in automation.

3. Prepare CRM

Not every CRM contains fields to store churn risk (0% - 100%) or a churn prediction (yes/no). If you plan on writing this information back to your CRM, add these fields to the customer object.

4. MySQL database

Create a new MySQL database to store customer information together with the churn risk. This database will be used to import records to your Qlik Sense App. You can use a different type of database or directly load the customers by creating a new connection in the Load Script.

5. Qlik Sense App

Build a new Qlik Sense App that you'll use to analyze the customer records and their churn risk. Make sure to feed the app with data from the previous step.

6. Marketing campaign

We'll automatically assign customers with a too-high churn risk to a marketing campaign that focuses on churn risk. In this example, we'll be using Marketo but this can be changed to any marketing campaign solution you use in your organization.

Our Marketo instance is set up to assign leads (customers) that are added to a certain list, to a marketing campaign that's connected to that list.


Once the prerequisites are completed, the automation can be built. Go to your Qlik Sense tenant and create a new automation.

  1. Search for the List New Updated And Deleted Accounts Incrementally block in the Salesforce connector and add it to the automation. When this block is executed for the first time, it will retrieve all account records from Salesforce. It will also set a pointer with the DateTime of its last execution. On the next executions, the block will only retrieve accounts that were created or updated after the pointer and it will update the pointer.
  2. We have no interest in predicting the churn risk for deleted customers so add a Filter List block and set the condition to only include records where IsDeleted is 'false'.
  3. Add a Condition block to verify if any new or updated records were received. If the output of the Filter List block is empty, a Stop block should be executed. This block will stop the automation and requires no further configuration.


  4. Add a Transform List block to transform the field names of the objects returned by the Filter List block into names that correspond with the fields in your AutoML(Legacy) model. You can skip this step if you used the raw output from your CRM to train the model and didn't apply any transformations before training.


  5. The list of accounts is now ready to generate predictions on, search for the Qlik AutoML connector and add the Get Express Predictions block to the automation. Specify your model's analysis id in the block's Inputs tab. The deployed model's token should be configured as the API Key parameter when adding a new connection in the block's Connection tab. Set the Primary Key in the Inputs tab to the name of the field your CRM system uses for the customer object's id. For Salesforce this is the Id field but we renamed it to RecordId in the Transform List block. Specifying this Primary Key will make it easier to later map the right predictions to the right customer.
    Below is a screenshot of the Prediction API credentials for an example analysis in Qlik AutoML, the analysis id is the final part of the Access URL:


  6. Add a Merge List block to merge the predictions from Qlik AutoML back into the customer records from the CRM that are outputted by the Filter List block. Having specified a Primary Key in the previous step will be very helpful now.
  7. Now that we have a list containing both the customer records and the predictions we can write them back to the CRM. Add an Update Account block from the Salesforce connector and add it to the loop created by the Merge Lists block. Update the fields that contain the churn risk and churn prediction, in Salesforce these need to be created as custom fields.
  8. Do the same for the MySQL database. Add the Upsert Record block of the MySQL connector after the Upsert Account block and configure it to send all relevant fields to the database.
  9. Add a Condition block in the loop that verifies if the predicted churn risk is greater than a certain threshold (we're using 0.75 which corresponds to a churn risk of 75%). Add a Send Mail block to the Yes part of the Condition block, now an email will be sent every time a customer exceeds the churn risk threshold. Make sure to configure the Send Mail block so it contains an informative message. Feel free to add alerting functionalities to other systems like Microsoft Teams.


  10. Add the blocks that interact with the Marketo marketing campaigns.
    1. Add a Create Or Update Lead block from the Marketo connector right before the Condition block. Configure this block with the customer data from the CRM so it has the necessary information to create or update leads.
    2. Add an Add Lead To List block after the Send Mail block in the Yes part of the Condition block. A churn-focused Marketo marketing campaign is configured to monitor this list and import any newly added leads.
    3. Add a Remove Lead From List block to the No part of the Condition block. This will make sure that customers without a high churn risk receive wrongly-targeted content from the Marketing campaign.


  11. Add a Do Reload block from the Qlik Cloud connector after the loop from the Merge Lists block to reload your Qlik Sense app that analyzes customer churn risk. Make sure to configure the app's load script so it imports the customer records from the MySQL database.

Automation run mode

Since this automation only processes new and updated records from the CRM, it's best to configure its run mode to Scheduled to make sure the automation is executed every x minutes. In this example, we've used 15 minutes but this will depend on your use case and type of customers.

Go here for more information on automation run modes.



Attached to this article, you'll find an exported version of the above automation as 'Predict Customer Churn Risk automation.json' See the How to import and export automations article to learn how to import exported automations.

The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.

Version history
Last update:
‎2024-03-01 03:25 AM
Updated by: