An average recall costs close to 10 million dollars, according to the Food Marketing Institute and the GMA. And when the recall is wider than necessary —because no one knows exactly which batches are compromised—, the median cost rises to 8.2 million per producer, with cases exceeding 72 million. The Qlik Sense batch traceability It exists so that scenario is never yours. Most plants have traceability data: it's in the ERP, in production logs, in dispatch guides. What they don't have is the ability to answer the critical question in minutes: «this batch of raw material was contaminated, which products and which customers did it reach?» I've seen quality teams take three days to put together that answer using spreadsheets. With a lot genealogy model in QlikSense, the answer takes as long as a click. This article shows you how to build it, with a complete script and real expressions.

The real problem: traceability that lives on paper
Voluntary product recalls in the United States rose from 313 in 2023 to 333 in 2024. In addition, the FDA traceability rule (FSMA 204) requires high-risk foods to have enhanced traceability with lot codes throughout the entire chain. Regulatory pressure is no longer a trend: it is the new baseline.
However, the biggest cost isn't the fine. It's the scope of the recall. When you cannot narrow the problem down to specific lots, you recall everything out of caution. In June 2025, Alma Pak International detected Listeria in organic blueberries. Thanks to a precise lot system, it identified two affected lots and narrowed the recall to a single customer. That is the difference between a controlled incident and a brand crisis.
The question for you as a leader is simple: if a supplier notifies you tomorrow of a compromised batch, how long does it take you to know exactly which shipments are affected? If the answer is measured in days, keep reading.

Qlik Sense batch traceability: the genealogy model
The heart of the system is a genealogy table: which input lot was consumed in which output lot. In practice, that relationship lives in the consumptions of the ERP production orders. The model has three pieces: raw material lots (receipts), the genealogy (consumptions per order), and shipments (which customer each finished lot went to).
Step 1: the commented loading script
// ------- 1) RECEIVINGS: Raw material batch and its supplier
Receivings:
LOAD
RawMaterialBatch, // supplier's batch
Supplier,
Material,
ReceiptDate,
QuantityReceived
FROM [lib://Data/receipts.qvd] (qvd);
// ------- 2) GENEALOGY: consumption of raw material batches in production orders
// Each row: order X consumed raw material batch X and produced finished product batch Y
Genealogy:
LOAD
MPBatch,
ProductionOrder,
PTBatch, // finished product batch
QuantityConsumed,
ProductionDate,
Line
FROM [lib://Data/consumos_op.qvd] (qvd);
// ------- 3) SHIPMENTS: Which customer received each finished product batch
Shipments:
LOAD
FinishedProductBatch,
Customer,
ShipmentTracking,
ShipmentDate,
QuantityShipped,
Country // key for export recalls
FROM [lib://Data/shipments.qvd] (qvd);
// ------- 4) Age flag to narrow down searches
Left Join (Shipments)
LOAD PTBatch,
If(ShipmentDate >= Today()-90, 1, 0) AS Within90d
RESIDENT Shipments;Notice the structure: Receptions is associated with Genealogy by LoteMP, and Genealogy is associated with Offices by LotePT. The QlikSense associative model does the rest. You don't need to program the tracing logic: the engine handles it. That's Qlik's unfair advantage over an SQL report: the propagation of selections IS the traceability.
Step 2: forward and backward tracing with P()
Forward tracing answers: «given a suspicious raw material batch, which customers received it?» With the P() function —the possible values— the expression is straightforward:
// Customers covered by the selected MP batch
Count(DISTINCT {<lotept =='' p({} PTBatch)>} Customer)
// Committed shipped kilograms
Sum({<lotept =="" p({} PTBatch)>} ShippedQuantity)
// Reverse trace: given a claimed PT batch,
// which suppliers are behind it?
Concat(DISTINCT {<lotemp =="" p({} BatchMP)>} Supplier, ', ')Let's break down the first formula from the inside out. P(BatchRM) take the selected raw material batches. The inner set {} restrict the genealogy to those plots, and P(... LotePT) return the finished product batches that consumed them. Finally, the outer set filters shipments to those FG batches and counts distinct customers. Three layers, zero procedural code.
Step 3: The crisis dashboard
The dashboard has one purpose: for the quality manager to execute a mock recall without IT assistance. The layout I use: at the top, a search field for LoteMP and LotePT with two giant KPIs: «Engaged Customers» and «Dispatched Kilos». In the center, a table of affected shipments with customer, waybill, date, and country, ready to export to Excel and attach to the notification. Below, the batch tree: reception → orders → FG batches → shipments, in a pivot table. To the right, distribution by country to activate export protocols.

Business impact: narrowing down is saving
Let's do the executive math. If a broad recall has a median cost of 8.2 million dollars and precise traceability allows you to pull two batches instead of two weeks of production, the savings are measured in millions per event. But the everyday return is quieter: every customer complaint is answered with evidence in minutes, every certification audit finds documented tracking, and every negotiation with a problematic supplier arrives with data on their rejected batches.
There is also a commercial effect. Retail chains and export markets already demand traceability responsiveness as a condition of entry. Demonstrating a live recall drill in minutes is a selling point that your competition likely cannot match.
Common Mistakes and How to Avoid Them
Vendor & '|' & MP-Lot AS %MP-LotCode, and use AutoNumber() to avoid paying the memory cost.Error 2: incomplete genealogy due to manual consumption. If production records bulk consumption at the end of the shift, genealogy loses precision. Measure data quality with a KPI: percentage of orders with recorded lot consumption. Publish it. What gets measured on a visible dashboard improves on its own.
Error 3: Load all history in the crisis app. For the recall simulation, 12 to 18 months are enough depending on your product shelf life. The rest goes to a separate historical app. The crisis app must open quickly: in a real emergency, every minute of loading time is a minute of exposure.
Error 4: Leaving the board without an owner. A traceability dashboard that nobody uses fails the day it is needed. Schedule quarterly drills with quality and logistics, just like a fire drill.
Best practices from experience
First, start with one product and one line, not the entire plant. A genealogy pilot on the most critical line gives you the argument and the learnings to scale. Second, integrate traceability with your supplier KPIs: a rejected batch should automatically hit the supplier's scorecard. Third, version the genealogy QVDs with daily incremental loads; traceability does not allow for «last week's data.» And fourth, document the complete flow as a crisis procedure, not as a BI manual: the end user is the emergency committee, not the analyst. In hectorpincheira.com find more strategies to convert operational data into managerial responsiveness.
Strategic conclusion
Traceability is not a compliance project: it is insurance with a return. It pays for itself the day a supplier calls you with bad news, and in the meantime, it improves your audits, your negotiations, and your commercial proposal. The data is already in your ERP. What is missing is the associative bridge that turns it into an immediate response.
This week, try the uncomfortable test: ask your team to trace a batch dispatched 60 days ago back to its raw materials. Time it. That number —hours or minutes— is your true risk posture. And now you know exactly how to change it.




