Query Returns Wrong Results

What this covers
Diagnosing incorrect values returned by Tessallite queries. If values are wrong, the cause is almost always in the model definition, data freshness, or the underlying source data — not in the routing layer.
Step 1 — Check the measure definition
Open Model Builder and navigate to the measure returning unexpected values.
- Verify the source column is correct. A column rename in the source table can produce wrong results if schema drift has not been detected.
- Verify the aggregation type: SUM, COUNT, COUNT DISTINCT, AVG, MIN, MAX.
- Check whether any filters are applied to the measure definition.
Step 2 — Check for grain mismatch
If a query asks for totals and an aggregate exists at a finer grain, Tessallite re-aggregates the pre-built summary. This is correct for additive measures but produces wrong results for COUNT DISTINCT.
If the query uses COUNT DISTINCT and returns a value that is too high, no exact-grain aggregate exists for that query pattern. Ask your Modeller to build an aggregate at the exact grain required, or reformulate the query to match an existing aggregate grain.
Step 3 — Check for stale data
In Model Builder, check the status column for each aggregate:
| Status | Meaning |
|---|---|
| Ready | Aggregate is current |
| Stale | Source has changed since last build — run a refresh |
| Building | Refresh in progress — wait for completion |
| Error | Last build failed — see Aggregates Not Building |
Step 4 — Check for schema drift
- Open Model Builder.
- Select the project.
- Go to the Health tab.
- Look for "Schema drift detected" warnings.
- Update the model to reference the correct column, re-publish, and rebuild aggregates.
Step 5 — Compare with a direct query
Run the equivalent query directly against the source database (bypassing Tessallite). If the direct query also returns wrong values, the problem is in the source data. If the direct query returns correct values, return to Steps 1–4.