QlikSense Lost Customers: Detect Silent Churn with P() and E() - featured image

Publications

Qlik Sense Lost Customers: Detect the Silent Leak with P() and E()

Hector Pincheira

Hector Pincheira

CIO | CTO
Digital Strategy & Technology Innovation

items

Your company is losing customers right now, and no one is paying attention. 38% of B2B customers are lost each year, and 84% of that loss is voluntary: the customer simply stops buying, quietly, without complaining. Identifying lost customers in QlikSense takes just minutes using two functions that almost no one knows how to use: P() and E(). And that lack of knowledge is costing more than one sales management team millions.

Qlik Sense Churned Customers - Detect silent churn with P() and E()
Lost Customers — Detect silent churn with P() and E()

Most dashboards celebrate what came in. Almost none show what left. Yet acquiring a new customer costs between 5 and 25 times more than retaining an existing one. That is: the most expensive report in your company is the one that doesn't exist.

In this article, we build, step by step, the leakage analysis that your sales team should review every Monday. With real expressions, ready to copy.

The real problem: the leak your ERP doesn't show you

The ERP records transactions. By design, what does not happen leaves no trace. A customer who used to buy every month and stopped doing so generates no alert: it generates silence. And silence does not appear on any standard list.

The numbers behind this problem are staggering. According to Bain & Company, improving retention by just 5 points can increase profits by between 25% and 95%. Furthermore, a repeat customer spends, on average, 67% more than a new customer. As if that weren’t enough, 73% of B2B companies report that their cost per lead rose significantly over the past year.

Put another way: every customer who slips away without you noticing is an asset you destroyed twice. First, you lost their cash flow. Then, you'll pay up to 25 times their retention cost to replace them.

💡 Key point: The missing data in your sales report isn't a sale. It's the sale that didn't happen. And that is precisely the one that defines your next year.
QlikSense lost customers - on-screen sales trend analysis
The sales curve shows what happened. The churn analysis shows what didn't happen.

QlikSense lost customers: P() and E() in action

Set Analysis has two element functions that answer impossible questions for a traditional report: P() return the values possible of a field in a given context, and e() return the values excluded. Combined, they make it possible to compare populations across periods.

The impossible question for the ERP

The question is simple to formulate and almost impossible to answer with basic SQL: which customers bought from me last year and haven't bought from me this year? That is, exactly, the intersection between two sets. P() and E() make that intersection natively.

Lost customers in a single expression

// Customers who made a purchase last year but have NOT made a purchase this year
Count({<cliente =="" p({} Customer)
              * E({} Customer)
>} DISTINCT Customer)

Let's break down the formula piece by piece, because here lies the value:

  • P({} Customer): the set of customers who made at least one purchase in the previous year. The $(=Max(Year)-1) expansion dynamically calculates that year; it will never become obsolete.
  • E({} Customer)the set of customers excluded of the current year, meaning those that do not record any purchases this year.
  • The * operator: intersection of both sets. They bought before AND do not buy now. That is your churn.
  • Count(... DISTINCT Cliente): counts unique customers, not transactions.

How much money went with them

Counting churned customers is useful. Valuing them is strategic. The following expression calculates the revenue at risk: what those customers billed last year and is not repeating this year.

// At-Risk Revenue: Last Year's Revenue from Lost Customers
Sum({<cliente =="" p({} Customer)
            * E({} Customer),
     Year = {$(=Max(Year)-1)}
>} Sales)

Notice the second modifier: Year = {$(=Max(Year)-1)}. Without him, you'd add zero, because the escapees have no sales this year. With him, you value the escape at the actual billing of the previous period. That number, placed in a red KPI at the top of the dashboard, changes management conversations.

New and recovered: the full picture

// NEW Customers: they made a purchase this year, but did not exist last year
Count({<cliente =="" p({} Customer)
              * E({} Customer)
>} DISTINCT Customer)
// RECOVERED customers: they made a purchase this year but not last year,
// yet they do have a purchase history
Count({<cliente =="" p({} Customer)
              * E({} Customer)
              * P({<año =="" {"} Customer)
>} DISTINCT Customer)

With these three expressions, you build a portfolio movement table: retained, new, recovered, and lost. It is the income statement of your customer base. Few views generate as much conversation in a commercial committee as this one.

The churn dashboard: how to build it

The view I recommend has three levels. At the top, four KPIs: lost customers, revenue at risk, churn rate (lost over the previous year's portfolio), and recovery rate. In the center, a waterfall chart showing portfolio movement: beginning portfolio, plus new customers, plus recovered, minus lost, ending portfolio. That chart tells the complete story in five bars.

Below is the nominal table: client, assigned executive, date of last purchase, billing for the last 12 months, and days without purchasing. Sorted by revenue at risk, descending. That is the table that is exported, assigned, and pursued. Add a commercial executive dimension and the committee conversation changes from «we are losing clients» to «who is losing which ones.».

QlikSense lost customers - printed customer portfolio charts
The portfolio movement is the income statement of your customer base.

Business impact: from dashboard to recovery

This analysis is not an academic exercise. It is a machine for generating concrete commercial action. First, it delivers a nominal list: name, assigned executive, last purchase, historical billing. Second, it allows prioritizing by revenue at risk: not all churned customers weigh the same. Third, it makes it possible to measure the recovery rate month by month, which is the KPI almost nobody has.

Let’s do the math that really matters. If your annual churn is around the B2B average of 38% and you manage to recover just 10% of that portfolio by reaching out to them in time, the return far exceeds that of any customer acquisition campaign. The math is simple: winning back a customer costs one phone call; acquiring a new one costs up to 25 times as much.

💡 Key point: A churn dashboard without a nominal list is just entertainment. The difference between analysis and action is having names and phone numbers on Monday morning.

Common mistakes when measuring churned customers

⚠️ Common error: Compare full year versus current year. If you are in June, comparing against the entire previous year artificially inflates the churn. Use 12-month rolling windows or equivalent periods (YTD versus previous YTD).
⚠️ Common error: Forget the DISTINCT. Without DISTINCT, you are counting transactions, not customers. The number skyrockets and you lose credibility at the first committee where someone notices it.
⚠️ Common error: Ignore selection state. P() and E() are evaluated on the user's active selections. If someone filtered a branch, your leak is the leak of that branch. Consciously decide which fields to fix within the set and document that decision.
⚠️ Common error: Define «lost» the same for everyone. A customer who buys every 15 days and hasn't bought in 90 days has churned. One who buys twice a year has not. Define the threshold based on the natural purchase frequency of each segment.

Best practices from the trenches

First, parameterize the churn window with a variable (for example, vChurnMonths) so the business can adjust the threshold without touching the expressions. Second, build the exportable nominal view: management wants names, not just curves. Third, add revenue at risk as the primary KPI; the customer count is secondary to the money.

Fourth, segment before sounding the alarm. A 20% churn among low-revenue customers may be healthy; a single key customer on the list could signal a crisis. Cross-reference the churn data with the ABC customer classification and treat them differently. Fifth, convert the monthly portfolio snapshot into a historical QVD file: in a year, you’ll want to know whether churn is improving or worsening, and that data series cannot be reconstructed retroactively.

Finally, measure the recovery rate of each rescue campaign. That cycle —detect, contact, measure— turns a Set Analysis expression into an ongoing business process. That is what BI done right is all about: as I have written before in hectorpincheira.com, technology doesn't decide for you, but it defines which decisions you get to see.

Strategic conclusion

Your competition isn't taking your clients away from you. You are letting them go without realizing it. The difference between those two phrases is a couple of Set Analysis expressions that are now in your hands.

P() and E() have been in QlikSense forever. What is scarce is not the function: it is the managerial decision to face churn head-on. Build the view this week, take it to the next commercial committee, and watch what happens when churn stops being invisible. The silence of leaving customers is expensive. Hearing it in time, is not.

Most Read

QlikSense Hierarchy: parent-child chart of accounts expanded by levels
QlikSense Hierarchy: the Chart of Accounts That Doesn't Add Up
QlikSense Sum TOTAL: share of each family over the total
QlikSense Sum TOTAL: the Percentage That Changes When You Filter
SAP Business One Inventory Revaluation - featured image of the tutorial
SAP Business One Inventory Revaluation: Fix Wrongly Loaded Costs
Empty chamber with wooden benches: the counterweight that required being present to be used
The Veto You Had to Say in Person: Your Decisions With No Counterweight
SAP Business One customizations - featured image of the pre-upgrade audit tutorial
SAP Business One Customizations: Pre-Upgrade Audit
SAP Business One Customer Concentration - featured image of the tutorial
SAP Business One Customer Concentration: Measure Your Risk with SQL

RELATED ARTICLES