QlikSense synthetic keys - modeling error

Publications

QlikSense Synthetic Keys: The Modeling Error That Silently Doubles Your Numbers

Hector Pincheira

Hector Pincheira

CIO | CTO
Digital Strategy & Technology Innovation

items

A sales manager checks the dashboard and sees that May's sales doubled April's. No one remembers any campaigns. No one hired more salespeople. The number is simply wrong. Almost always, behind an unexplained business jump, there is QlikSense synthetic keys poorly resolved in the data model. It is the most silent error in all of QlikSense. It does not break the load. It does not show a red message. And yet it multiplies rows under the radar, until someone notices that a total does not match the original source.

QlikSense synthetic keys - impact on memory and model performance

This article explains what Qlik Sense synthetic keys are and why they appear. It also shows when they are actually a problem. And, above all, how to eliminate them with a script redesign that also reduces memory and speeds up the model.

The real problem: what are Qlik Sense synthetic keys and when do they hurt

Qlik Sense automatically creates a synthetic key when it detects that two or more tables share two or more fields with the same name. Instead of asking, it resolves the cross-reference for you. It generates an internal table, visible in the Data Model Viewer as $Syn 1. That table combines all possible values of the shared fields.

The symptom isn't always visible. When the cardinalities between tables don't align well, each additional combination of the synthetic key multiplies the number of rows in the join. A technical report from Ometis documents something that confirms this risk: memory usage can rise to 300% with complex synthetic keys in large models. That’s not just a performance issue. It’s a trust issue. If the number is inflated, every decision based on it is as well.

⚠️ Common error: ignore the synthetic key warning because «the app loads anyway.» It loads, yes. But the total sales per customer might be counting each invoice multiple times if another table shares the date and customer without an explicit key.

How to resolve QlikSense synthetic keys from the load script

The synthetic key is not the disease. It is the symptom of a model that let Qlik decide entirely how to join two tables. The real solution happens in the load script, before the engine has to invent anything.

Before: the model that generates the synthetic key

Sales:
LOAD
    DocumentDate,
    CustomerID,
    DocumentNumber,
    Amount AS SalesAmount
FROM Sales.qvd (qvd);
Collections:
LOAD
    DocDate,
    CustomerID,
    DocNumber,
    Amount AS CollectionAmount
FROM Collections.qvd (qvd);
// DocDate + CustomerID + DocNumber: 3 shared fields.
// QlikSense automatically creates $Syn 1 to resolve the lookup.

Three shared fields between two fact tables is the exact recipe for a synthetic key. QlikSense doesn't know if you meant «the same document» or simply «these three values happen to match by coincidence.» It assumes the latter, and that's where the problem begins.

Afterward: explicit key and own fields per table

Sales:
LOAD
    DocDate,
    CustomerID,
    DocumentNumber,
    AutoNumber(CustomerID & '|' & DocumentNumber) AS %DocKey,
    Amount AS SalesAmount
FROM Sales.qvd (qvd);
Collections:
LOAD
    DocDate AS CollectionDate,
    CustomerID AS CollectionCustomerID,
    DocumentNumber AS CollectionDocumentNumber,
    AutoNumber(CustomerID & '|' & DocumentNumber) AS %DocKey,
    Amount AS CollectionAmount
FROM Collections.qvd (qvd);
// Now they only share %DocKey: a unique and explicit key.
// There is no synthetic table. The join is controlled and documented.

The change has two movements. First, the context fields that should not join the tables are renamed, such as Invoice Date instead of Document Date. Second, an explicit composite key is constructed using &, wrapped in AutoNumber(). That function converts the concatenated text into an internal integer, which reduces the memory footprint compared to keeping the entire string as a join key.

The result: each table retains its original structure, without duplicate fields. And the key that links them is a design choice, not an improvisation by the engine. That’s the difference between resolving a synthetic key and simply hiding it.

When It IS a Good Idea to Use a Synthetic Blend

Not every synthetic key is a mistake. If two tables share exactly the same two fields and the cardinalities are clean, Qlik can resolve the join correctly and even efficiently. The risk arises when there are three or more shared fields, or when one of the tables has multiple rows per key combination. That’s when the count skyrockets.

💡 Key point: before deleting a synthetic key, check if it is actually inflating totals. Compare the total of a simple measure, like Count(DocumentNumber), against the actual count at the source. If they match, maybe you don't need to touch anything.

A real-life case: the invoice that was counted twice

A distribution company had two fact tables: Sales and Collections. Both shared the date, client, and document number, without anyone having designed it that way. QlikSense created its synthetic key, the app loaded without errors, and the dashboard went live smoothly.

Three weeks later, the finance department discovered that a major client’s total sales exceeded the ERP’s figures by 40%. The cause: that client had several partial payments for each invoice, and the synthetic key multiplied the sales rows by each associated payment. No one touched a single Set Analysis formula. The error lay in the model, not in the metric.

After applying the explicit key %DocKey and separating the context fields, the total matched the ERP again on the first refresh. The lesson wasn't technical, it was about process: every new model needs a review in the Data Model Viewer before being published, not after someone complains.

Business Impact: Numbers You Can Trust

A model without uncontrolled synthetic keys is not only faster. It is more credible. The finance team stops finding discrepancies between the ERP total and the QlikSense total. And, with that, they stop wasting hours reconciling figures that should never have gotten out of alignment in the first place.

The impact on memory is also real. Klarmetrics reports that a clean star schema, with a central fact table and well-defined dimensions, reduces memory usage by up to 70%. In addition, it improves query performance by 3 to 5 times compared to a model with unresolved synthetic keys. That difference matters outside the lab. In an app running on a shared server with dozens of concurrent users, it determines whether the dashboard responds in two seconds or twenty.

Common mistakes when resolving surrogate keys and how to avoid them

  • Rename all shared fields, including the actual key: The goal is not to stop the tables from relating, but to relate them by the correct key. Rename the context fields, not the business key.
  • using Join instead of a key and two separate tables: a Join miscalculated on fields with multiple cardinality duplicates rows just like the synthetic key. Only in a less visible way, because there is no longer a warning in the load log.
  • Do not check the Data Model Viewer after each script change: A new synthetic key can appear by adding a single table. Reviewing the model should be part of the checklist before publishing, not an exception.
  • Concatenate fields of different types without normalizing: Joining a numeric ID with a text ID generates false matches. It can also generate silent nulls. Apply Text() o Num() before concatenating.

Best practices for a clean model

Adopt the convention QUALIFY * followed by DISQUALIFY only on the fields that must act as a key. Thus, each field is automatically qualified with the name of its source table, except for the key you decide to expose.

Document every composite key in the governed data model of the project, with its exact formula and the business rationale behind it. The next developer who touches the script needs to understand why it exists %DocKey, not only that it exists.

Finally, add an automatic validation in the script. A IF compare the row count before and after any Join or concatenation, and write an alert to the log if the count grows more than expected. It is cheap to build. And it detects a poorly resolved synthetic key before it reaches production, rather than after finance complains about a number that doesn't add up.

None of these practices require additional tools or extra licenses. They are design decisions that fit into any load script, regardless of company size or model complexity. The only thing they require is discipline: reviewing the Data Model Viewer with the same seriousness with which a financial statement is reviewed before presenting it to the board of directors.

Strategic conclusion

The QlikSense synthetic keys they do not forgive improvisations. They appear silently, inflate numbers silently, and are only noticed when someone compares against the source and finds a discrepancy that shouldn't exist. As the technical analyses by explain the Qlik community, the synthetic key is almost never the problem itself. It's the sign that the model needs a design decision that no one has made yet.

Next time QlikSense warns you about a synthetic key, don't ignore it or blindly delete it. Ask yourself what real business relationship you are trying to express between those two tables. The answer to that question is the data model you should have built from the beginning.

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