An AI analyst can count every row in your warehouse correctly and still yield a misleading answer if you're not careful. The problem is rarely the arithmetic. It's the rules of aggregation: which rows count, how they're grouped and what the words mean. Mathematicians have argued about those rules for hundreds of years, and we still get them wrong every time we collect preferences across sources or step into a voting booth.
The election nobody wanted to win
Before I joined Weld as a data engineer, I worked at the University of Southern Denmark on research into how different ways of counting a vote can affect the outcome. The classical way we vote is one-person-one-vote. It is easy to comprehend, but it might not reflect the inherent wishes of a population.
For instance, consider the following example: one hundred people pick tonight's playlist genre. Each of them tells us their favorite and least favorite genre, and then, in the old-fashioned democratic way, we choose the genre with the most first-choice votes.

Under one-person-one-vote, Jazz wins with 35 votes. Yet 65 of the 100 rank it dead last, while Rock beats both rivals head to head, which makes Rock the Condorcet winner. Every vote was counted correctly, and nobody voted tactically. Still, the most polarizing option won, even though most people would rather have had Rock.
The lesson stuck with me: a correct calculation is not always the same as a correct answer. The answer depends on the question you asked, the rules you chose and the data you fed in. At Weld, I see the same pattern every week. Only now, the one counting the votes is an AI.
Same question, three answers
Ask an AI agent connected to your data warehouse, "What was our revenue last month?", and you'll get a number: fast, well-formatted and delivered with total confidence. Ask again with different wording, or ask a colleague's agent, and you may get another. Here are three queries that all ran and are all valid SQL. They just answered different questions:
- One summed Shopify orders, including refunds and VAT.
- One summed Stripe charges, net of refunds.
- One missed the finance team's recognized-revenue table, because nobody told the agent it existed.

That's the voting problem again. The arithmetic is fine, but the rules of aggregation were chosen silently by the AI. And this now affects most data teams: in Joe Reis's 2026 survey of 1,101 data practitioners, 82% said they use AI every day. The question has moved from "should we use AI on our data?" to "when can we trust what it says?"
Why AI answers go wrong (it's rarely the SQL)
When an AI analyst is wrong, the query usually runs fine. The failure sits in one of four places a statistician would check first.

1. Undefined terms
Ask five teams what "revenue" or "active user" means and you'll get five answers. If nobody wrote the definition down, the agent guesses from column names, and a guess that looks reasonable is the most dangerous kind.
So write it down once, somewhere everyone reads from. That's the job of a semantic layer: "revenue" is defined a single time, so your dashboard, your spreadsheet and your AI agent all land on the same number. More on that in what a semantic layer is and why AI agents need one.
2. Who is in the sample
Every number comes from some set of rows. Test accounts? Internal orders? The weeks before a connector was set up? An AI won't ask who's missing unless you make it.
Decide who belongs in the data once, in the model, not in every query. In statistics, getting this wrong is called sampling bias, and the cure hasn't changed: define the population before you count it. Here's a practical walkthrough: Medallion Architecture: Bronze, Silver and Gold Layers Explained.
3. Messy or moving data
Real data is full of duplicates, deleted records, late events and currencies mixed in one column. An analyst who knows the data can feel when a number is off. An agent can't, unless it can check.
Keep a history of what changed instead of overwriting it, so you can explain why last month's number moved. Then add a few simple checks for duplicates and nulls before anyone reads the result. See Track Every Change with History Tables.
4. The aggregation trap
This is where the voting lesson comes back. Say you ran two campaigns and asked your AI agent which one converted better:

Campaign A wins on desktop and on mobile. Yet campaign B wins overall, because most of its traffic came from desktop, where everyone converts better. This is Simpson's paradox, and it's the same trap as the election: every number is counted correctly, but how you add them up decides the winner.
An AI agent will happily answer either "A" or "B" with total confidence. A good analyst answers "it depends on how you split it" and shows both.
Better definitions help, but you still have to check
Writing definitions down makes a real difference. In a 2026 benchmark, three frontier models answered 99 business questions about a retail data warehouse. A short document defining the business terms lifted all three from about half to about 68% correct, and a smaller model with the document beat a larger one without it. That still left roughly one answer in three wrong.
Checking isn't a sign of distrust. It's how serious work gets done, even at the frontier. In November 2026, Anthropic shared a set of results with several cryptographers, including a new quantum attack on lattice cryptography, the math behind some next-generation encryption. Two weeks later, the cryptographers published an initial assessment: the attack "falls far short of compromising the current NIST standards," though they expect it to be improved. If that work gets a second look, your revenue number deserves one too.
Six questions before you trust an AI's number
- What exactly was counted? Ask for the SQL and a plain-words explanation. No explanation, no trust.
- Is the definition written down? If it lives in someone's head, the AI is guessing.
- Who's in the data, and who isn't? Date ranges, test accounts, internal users.
- Does it match a number you already trust? Shopify admin, Stripe, last month's finance report.
- Would another reasonable method flip it? Gross vs. net, overall vs. per segment. If it does, report the method with the number.
- Does it hold up over time? One month can be noise.

Count the votes, but check the rules
Every election I studied had the same twist: nobody cheated, every ballot was counted, and the result could still miss what people actually wanted. Your AI analyst is in the same position. It counts perfectly, but it can't know that revenue means net of refunds, that test accounts don't belong, or that campaign A won every segment. Somebody has to set the rules, and that somebody is you.
None of this needs a particular tool, but the right foundation makes it easier: sources synced on schedule, models where "revenue" is defined once, and a semantic layer on top so every dashboard and agent reads the same definition. That's the part Weld runs, and we've written up how the pieces fit together in the agent context stack.
The AI will count the votes. Make sure you write the rules correctly.
Want one definition of revenue across your dashboards and agents? Start with the agent context stack, or talk to our engineers about setting it up.
Sources
- Rumiantsau & Fokeev (2026), Semantic Layers for Reliable LLM-Powered Data Analytics
- Joe Reis: Where Data Engineering Is Heading in 2026
- CIRG: Initial Assessment of Anthropic's Findings on Lattice Cryptography
- Wikipedia: Social choice theory
- Wikipedia: Condorcet winner criterion
- Wikipedia: Simpson's paradox
- Weld: The agent context stack



