Qlik Sense cost to serve

Publications

QlikSense Cost to Serve: Discover Which Customers Cost You More Than They Leave Behind

Hector Pincheira

Hector Pincheira

CIO | CTO
Digital Strategy & Technology Innovation

items

The customer who buys the most from you can be, at the same time, the one who impoverishes you the most. It is not a paradox: it is arithmetic. The Qlik Sense cost to serve exists to reveal exactly that, because your income statement only shows the average, and the average hides the predators. The data is uncomfortable. According to the cost-to-serve analyses documented in the industry, between 20% and 40% of a typical company's customers are not profitable. In addition, Kaplan and Narayanan's whale curve is even more brutal: the top 20% generates between 150% and 300% of net profit, while the bottom 10% to 20% destroys between 50% and 200% of that same profit. That is, your company makes money in spite of part of its portfolio, not thanks to it.

Qlik Sense cost to serve

However, almost no ERP answers that question. The cost of serving does not live in the invoice. It lives in the urgent freight, in the sales rep's visit, in the three-box order and in the Tuesday credit note.

The real problem: your gross margin is a comfortable lie

When a sales manager defends a customer, he almost always uses the same argument: «that customer invoices a lot». But invoicing is not earning. Between the invoice line and the final profit there is a chain of costs nobody assigns to anybody. Therefore, they end up buried in selling and administrative expenses, spread as if every customer consumed the same. They do not. That is, the QlikSense cost to serve starts right where your ERP's accounting ends.

Think of two customers who buy the same ten million a year. The first orders once a month, receives at his warehouse and pays in thirty days. The second orders eleven times a month, demands partial shipments, returns 4% and pays in ninety. The gross margin of both is identical in your system. The real margin, on the other hand, can differ by twenty points. In fact, in a classic documented case, the two highest-volume customers turned out to be the least profitable in the whole portfolio.

Likewise, this blindness has an enormous strategic cost. Without cost to serve, the sales force chases volume, operations absorbs the inefficiency and general management approves discounts on a false basis. In addition, every growth campaign amplifies the problem. If you grow on value-destroying customers, you grow toward a loss.

💡 Key point: the cost to serve is not an accounting calculation, it is a change of conversation. It turns «how much do they buy from me» into «how much do I keep after serving them».

The solution: build the QlikSense cost to serve step by step

The logic is simple to state and demanding to implement. First you identify the activities that consume resources when serving a customer. Then you assign a unit cost to each activity. Finally you multiply that cost by the real frequency of each customer. In QlikSense this is solved with a rate table mapped in the script and a service fact table.

Step 1: the activity rate table in the load script

// ============================================================
// RATE TABLE: unit cost per activity driver
// Source: cost accounting. Quarterly review.
// ============================================================
MapCostoActividad:
MAPPING LOAD
    Actividad,
    CostoUnitario
FROM [lib://Costos/tarifario_actividades.xlsx]
(ooxml, embedded labels, table is Tarifario);
// ============================================================
// SERVICE FACTS: every event that consumes resources
// ============================================================
ActividadesServicio:
LOAD
    ClienteID,
    PedidoID,
    Date(FechaEvento)                                      AS FechaEvento,
    Actividad,
    Cantidad,
    Cantidad * ApplyMap('MapCostoActividad', Actividad, 0) AS CostoServir
FROM [lib://QVD/3_Present/actividades_servicio.qvd] (qvd);

Now, let us stop at the third argument of ApplyMap. That 0 is your safety net. If a new activity appears with no rate, the script does not fail and does not invent a cost either. It simply values it at zero and you detect it later with a quality control. Without that argument, QlikSense would return the activity name as text, and your sum would be contaminated.

The typical activities of an industrial rate table are few and powerful. Sales visit, picking line, shipment, urgent off-route shipment, return, credit note, after-sales call and day of credit granted. Eight drivers explain, in my experience, more than 80% of the variation between customers.

Step 2: measures that separate gross margin from real margin

// --- Governed variables (Variables tab of the script) ---
SET vVentaNeta   = Sum({<TipoDoc={'FACTURA','NOTA_DEBITO','NOTA_CREDITO'}>} VentaLinea);
SET vMargenBruto = Sum({<TipoDoc={'FACTURA','NOTA_DEBITO','NOTA_CREDITO'}>} MargenLinea);
SET vCostoServir = Sum({<Escenario={'REAL'}>} CostoServir);
SET vMargenReal  = ($(vMargenBruto)) - ($(vCostoServir));
// --- Cost-to-serve index: how much each peso sold costs ---
SET vIndiceCTS   = $(vCostoServir) / RangeMax($(vVentaNeta), 1);

Note the use of RangeMax(..., 1) in the denominator. It is a guard against division by zero when a customer has net returns and zero sales in the selected period. Without that guard, your table fills with null values in exactly the most interesting rows.

Note also that the modifier of vMargenBruto includes the credit notes. Many dashboards exclude them so as «not to dirty the margin». That is precisely the bias we are fighting. A customer who returns a lot must carry that cost in his own line.

Step 3: the whale curve, the chart that changes meetings

That is, the whale curve sorts customers from highest to lowest real margin and accumulates the result. The chart rises, reaches a maximum above 100% and then falls. Everything to the right of that maximum point is your value-destroying portfolio.

// Line chart
// Dimension: ClienteNombre  (order: by expression $(vMargenReal), descending)
// Measure:   % cumulative of the total real margin
RangeSum( Above( TOTAL $(vMargenReal), 0, RowNo(TOTAL) ) )
/
Sum( TOTAL Aggr( $(vMargenReal), ClienteID ) )

So let us break down the expression. Above(TOTAL ..., 0, RowNo(TOTAL)) returns a vector with the value of the current row and all the previous ones. Then Range Sum sums that vector and generates the running total. Finally the denominator calculates the total real margin of the portfolio using Aggr by customer, without the order of the dimension altering it. The result is a cumulative percentage any manager can interpret in five seconds.

Step 4: the ranking of the ten that destroy the most

// Calculated dimension of a "Top 10 margin destroyers" table
=Aggr(
    If( Rank( TOTAL -($(vMargenReal)) ) <= 10, ClienteNombre ),
  ClienteNombre)
// Supporting measures in the same table:
//   Gross margin     -> $(vMargenBruto)
//   Cost to serve    -> $(vCostoServir)
//   Real margin      -> $(vMargenReal)
//   CTS index        -> Num($(vIndiceCTS), '0.0%')
//   Orders           -> Count(DISTINCT PedidoID)
//   Average ticket   -> $(vVentaNeta) / Count(DISTINCT PedidoID)

The minus sign in front of the expression inverts the ranking. This way, the customer with the most negative real margin takes first place. In addition, including the average ticket in the same table is deliberate. It almost always reveals that the problem is not the customer, but the order size we allow him to place.

Business impact of the QlikSense cost to serve

In fact, a cost-to-serve dashboard is not for firing customers. It is for negotiating with evidence. As a result, the decisions it enables are of four kinds, and all of them are actionable the same week.

  • Redesign the commercial policy. Minimum order, visit frequency by segment and the cost of urgent shipping passed on to the price.
  • Migrate the service channel. Small, high-frequency customers are better served through a portal or telesales than with an on-site visit.
  • Renegotiate terms. A customer with a cost-to-serve index of 14% does not need less discount: he needs a different delivery model.
  • Reorient the sales targets. Paying commission on real margin, and not on gross sales, changes behavior within a quarter.

In addition, the return is direct. If the bottom 10% of your portfolio destroys the equivalent of 50% of your profit, recovering half of that destruction improves the result by 25% without selling a peso more. That is why this analysis tends to be the BI project with the highest return per hour invested.

Common Mistakes and How to Avoid Them

⚠️ Common error: spreading the cost to serve as a percentage of sales. That is not activity-based costing, it is the same average under another name. If the driver does not change between customers, the analysis discovers nothing.

Allocate instead of measure. In a serious QlikSense cost to serve, the cost must follow the real event: a shipment, a visit, a return. If you do not have the data, start with three measurable drivers and grow later. An imperfect but real model beats an elegant, invented one.

Calculate the cost to serve over a single month. However, seasonality distorts everything. Use twelve rolling months to stabilize the signal and avoid condemning a customer over one bad month.

Forget the financial cost of credit. In fact, payment days are a driver too. Multiply the customer's average balance by your daily cost of capital and you will have one more line in the rate table.

Show the dashboard to sales first. It sounds counterintuitive, though it is better to validate the model with operations and finance first. If the commercial area finds a methodological error in the first meeting, the project dies right there.

Best practices for your QlikSense cost to serve

First, freeze the rate table by quarter and version it with an author and date header in the script. If the unit cost changes every week, nobody trusts the comparison between periods.

In addition, store the precalculated cost to serve in the presentation layer of your QVDs, not in the chart expression. This way the engine does not recalculate row-by-row multiplications on every click, and the dashboard responds fast even with years of history.

Likewise, publish a single master measure of real margin. If three definitions coexist, you will go back to the problem of the three truths that already costs dearly in any organization. You can go deeper into KPI governance in the rest of my articles at hectorpincheira.com.

Finally, pair every customer in red with a hypothesis of cause. A number without a cause generates discussion. A number with a cause generates a decision.

Conclusion: the map that puts your portfolio in order

For years we navigated profitability with a broken compass. We looked at sales because it was the available data, not because it was the right data. The QlikSense cost to serve fixes that instrument and gives you back the real position of your ship. It is not an academic exercise. It is the difference between growing and getting fat.

That is why the question you should take to your next committee is not how much we sold. It is how much we kept after serving whoever bought from us. If today you cannot answer it customer by customer, you already have your next BI project. And it is probably the one that will free up the most cash this year.

Sources consulted: cost-to-serve and customer profitability analyses at Cost & Profitability, research by Kaplan and Narayanan on the whale curve, and the cost-to-serve guide from BDO.

Most Read

Ballena jorobada bajo el agua con su aleta pectoral extendida: la esperanza en la tecnología y la biomimética
La ballena que volvió: la esperanza en la tecnología y la que no cabe en un tablero
SAP data in ChatGPT: an open door at the far end of a dark room
The Tab Next Door: The SAP Data in ChatGPT That Nobody Authorized
SAP Business One Purchase Price Variance - featured image of the tutorial
SAP Business One Purchase Price Variance: Detect the Inflation in Your Buying Costs
QlikSense format changeovers: actual minutes against the standard
QlikSense Format Changeovers: the Minutes Nobody Bills
QlikSense buttons and actions: executive dashboard with indicators
QlikSense Buttons and Actions: the Dashboard that Runs the Meeting
SAP Business One Internal Reconciliation - featured image of the tutorial
SAP Business One Internal Reconciliation: Clear False Open Items

RELATED ARTICLES