Qlik Sense Margin Analysis: Identify Products and Customers That Truly Generate Value - featured image

Publications

Qlik Sense Margin Analysis: Identify Products and Customers That Truly Generate Value

Hector Pincheira

Hector Pincheira

CIO | CTO
Digital Strategy & Technology Innovation

items

If your executive report says your company has an average margin of 28%, you are probably looking at a lie told elegantly. The average hides what actually matters: who makes you money and who takes it from you in silence. The QlikSense margin analysis exists to break that illusion and show you the business as it is, not as you would like it to be.

QlikSense Margin Analysis - Which products generate real value
Margin Analysis — Which products create real value

According to a study by Harvard professors Robert Kaplan and V.G. Narayanan, the top 20% of your customers can generate between 150% and 180% of your profits. The next 60% barely breaks even. And the bottom 20% destroys between 50% and 80% of the profit the rest produced. That is the whale curve. And almost nobody looks at it.

QlikSense margin analysis in a financial dashboard
The average margin hides how the business really behaves.

The illusion of the average margin

Managers who only look at the consolidated margin usually have an invisible problem: the mix of profitable and loss-making products produces a number that looks healthy. Meanwhile, inside that average there are lines destroying value, customers who cost more than they pay, and commercial discounts nobody reviews.

The problem is not missing data. The problem is that the data is right there and nobody interrogates it. That is why the ERP on its own is not enough. You need a tool that lets you compare, segment and break down profitability in real time. QlikSense was designed for exactly that.

The whale curve: an uncomfortable truth

The 80/20 rule is a good starting point, but it is too optimistic. The operational reality is harsher. If you plot cumulative profit customer by customer, sorted from highest to lowest margin, you get a curve that rises, peaks and then falls. That final drop is your value-destroying customers.

This is not about dropping customers lightly. It is about knowing which relationships to renegotiate, which products to retire, which discounts to adjust. Without that diagnosis, commercial decisions get made on intuition or under pressure. And intuition rarely beats well-presented data.

💡 Key point: Only 18% of finance teams close the month in three days or less. Half of them take more than five business days. Automating margin analysis is not a luxury; it is competitiveness.

QlikSense margin analysis with Set Analysis

Set Analysis is the syntax that lets QlikSense answer comparative questions without rewriting the model. It is the tool that separates the user who looks at charts from the analyst who makes decisions.

Real margin per customer, net of rebates and credit notes

Accounting margin and real margin rarely match. Credit notes, rebates and returns usually fall outside the calculation when a simple subtraction is used. This expression shows you the true margin per customer:

// Real adjusted margin per customer
Sum({<TipoDoc={'Factura','Boleta'}>} VentaNeta)
- Sum({<TipoDoc={'NotaCredito'}>} VentaNeta)
- Sum({<TipoDoc={'Factura','Boleta'}>} CostoVenta)
- Sum({<TipoConcepto={'Rappel','Bonificacion'}>} Monto)

Every element of the formula has a purpose. The first Sum brings in the gross documented sales. The second subtracts what was returned. The third deducts the cost. The fourth applies the commercial agreements many people forget to record as negative margin. The result: the margin your customer actually left you.

YTD vs. previous year comparison by product

Comparing against the prior year is the fastest way to spot structural deterioration or improvement. This expression calculates the current year's YTD margin and compares it with the same period of the previous year:

// Current-year YTD margin
Sum({<Año={$(=Max(Año))}, Mes={"<=$(=Max({<Año={$(=Max(Año))}>} Mes))"}>}
    VentaNeta - CostoVenta) /
Sum({<Año={$(=Max(Año))}, Mes={"<=$(=Max({<Año={$(=Max(Año))}>} Mes))"}>}
    VentaNeta)
// Prior-year YTD margin (same period)
Sum({<Año={$(=Max(Año)-1)}, Mes={"<=$(=Max({<Año={$(=Max(Año))}>} Mes))"}>}
    VentaNeta - CostoVenta) /
Sum({<Año={$(=Max(Año)-1)}, Mes={"<=$(=Max({<Año={$(=Max(Año))}>} Mes))"}>}
    VentaNeta)

What matters about this approach isn't the formula itself. It's what it reveals when you drop it into a pivot table by product: the lines that are systematically losing margin without anyone ever touching the price. That's the information a management committee needs to see every month.

Automatic detector for customers in the red zone

A good dashboard doesn't just display; it classifies. This expression assigns a traffic light to each customer based on their weighted margin:

// Profitability traffic light by customer
If(
   Sum(VentaNeta - CostoVenta) / Sum(VentaNeta) < 0.10,
   'rgb(220,38,38)',   // RED: margin < 10%
   If(
      Sum(VentaNeta - CostoVenta) / Sum(VentaNeta) < 0.20,
      'rgb(245,158,11)', // YELLOW: 10% - 20%
      'rgb(34,197,94)'   // GREEN: > 20%
   )
)

You apply that expression as the background color in a table, and suddenly sales stops arguing about perceptions and starts working with evidence. Customers in red become review targets, the yellow ones go on watch, and the green ones are protected as strategic assets.

The load script: where the truth lives

Pretty expressions won't save a badly loaded model. Real profitability requires integrating sales, direct costs, allocable indirect costs and commercial arrangements into a single associative model. Here's a script pattern that works:

// Consolidated fact table
HechosMargen:
LOAD
    DocClave,
    ClienteID,
    ProductoID,
    Fecha,
    Year(Fecha) AS Año,
    Month(Fecha) AS Mes,
    TipoDoc,
    VentaNeta,
    CostoVenta,
    VentaNeta - CostoVenta AS MargenBruto
FROM [lib://Datos/ventas.qvd] (qvd);
// Add commercial concepts (rebates, bonuses)
Concatenate (HechosMargen)
LOAD
    DocClave,
    ClienteID,
    ProductoID,
    Fecha,
    Year(Fecha) AS Año,
    Month(Fecha) AS Mes,
    TipoConcepto AS TipoDoc,
    -Monto AS VentaNeta,   // negative: reduces margin
    0 AS CostoVenta,
    -Monto AS MargenBruto
FROM [lib://Datos/conceptos_comerciales.qvd] (qvd);

This pattern uses Concatenate to unify heterogeneous concepts into a single fact table. That way, when the dashboard adds up margins, rebates and bonuses are already deducted. Without this, any margin report is fiction.

Executive dashboard: three screens that change the conversation

A margin dashboard that works doesn't need twenty objects. It needs three clear screens. The first, a panoramic view with consolidated margin, monthly evolution and the whale curve by customer. The second, a ranking of winning and losing products with variance against the prior year. The third, a drill-down by customer with order detail, discounts and individual margins.

That structure lets the general manager understand in thirty seconds where the losses are. Sales finds the customers to renegotiate. The controller validates the discounts applied. Three roles, one single source of truth.

Executive QlikSense margin analysis dashboard
Three well-designed screens replace twenty disconnected reports.

Common Mistakes and How to Avoid Them

⚠️ Common error: Calculating margin on gross sales without factoring in credit notes or rebates. The number looks fine until someone does a real cut-off.

The first common mistake is ignoring commercial arrangements. Companies tend to report accounting margin and forget the commercial agreements that reduce actual revenue. The consequence is a chronic overstatement of margin, especially with large customers on special terms.

The second mistake is calculating margin on standard costs instead of actual costs. Standard cost is for budgeting, not for evaluating executed profitability. If your company has volatility in inputs, the gap is brutal.

The third mistake is not separating contribution margin from net margin. Contribution margin only deducts variable costs. Net margin includes allocable expenses. Confusing them leads to bad decisions about which products to keep or discontinue.

The fourth mistake is presenting margin without temporal context. A 22% margin can be excellent or terrible depending on the trend. Without a comparison against the prior period, against budget and against the industry, the number is just a loose data point.

Implementation best practices

Start with the data model, not the visualization. If the model is dirty, no pretty chart is going to save it. Invest time consolidating your sales, cost and commercial arrangement sources into clean QVDs. This sets the quality ceiling of the entire analysis.

Define the critical dimensions with the business, not with IT. Customer, product, channel, salesperson, region: the list looks obvious, but the hierarchies matter. The same customer can belong to several channels, and that changes the calculation logic.

Build a master calendar and use it for every time-based analysis. Without a single calendar, YTD, QTD and MTD comparisons become inconsistent. It's one of the most expensive mistakes to reverse later.

Finally, validate the numbers with finance before showing them to the board. A dashboard that delivers figures different from the income statement loses credibility in five minutes. And credibility, once lost, doesn't come back with a footnote. If you want to go deeper into connecting data strategy with the business, find more resources at hectorpincheira.com.

Real business impact

Companies that automate their margin analysis with QlikSense cut the financial close cycle by 40% to 60%, according to PwC benchmarks. They improve data accuracy by up to 90%. And, most importantly, they recover management time: finance teams that automate save up to 30,000 hours a year per 100 employees.

But the deepest impact isn't measured in hours. It's measured in decisions. When a sales manager can see, in thirty seconds, which customers are draining margin, they stop arguing from gut feel. When the board sees the whale curve, it stops approving blanket discounts. And when the owner understands that the average margin lied to them for years, the entire company culture changes.

Conclusion: margin isn't averaged, it's interrogated

Margin analysis with QlikSense isn't a luxury for large companies. It's the difference between driving with a speedometer and driving while watching the GPS, the mirrors and the engine at once. A manager who only sees the average margin believes things are going well. A manager who sees profitability by customer, product and period knows exactly where they stand, what's coming and what decisions are left.

Your P&L tells you a story. QlikSense shows you the full film, scene by scene. The question isn't whether your company is profitable. The question is: do you know where you win and where you lose, or do you only know the bottom line of the income statement?

Exclusive content from the Círculo Estratégico. If you want to take your BI from theory to real operation, this is the place.

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