Decision
What decision should this analysis improve?
Use AI to compress the mechanical parts of analysis without outsourcing the question, metric definition or judgment.
The quality of AI analysis depends less on a clever prompt than on the quality of the analytical context you provide.
“The query runs and the numbers look reasonable. Can we send the conclusion to leadership?”
Fast syntax generation is useful, but an AI system does not automatically know your metric contracts, grain, exclusions, late-arriving data rules or business decision.
A strong workflow gives AI a structured analytical brief first, then treats generated SQL as a draft that must earn trust.
What decision should this analysis improve?
Provide metric contracts, exclusions and time logic.
State table grain, keys, relationships and known caveats.
Specify the required grain, comparisons and validation checks.
Do not ask AI to “analyze the data” when you have not defined what a correct answer would look like.
Business question:
Explain the week-over-week decline in completed orders.
Decision:
Determine which area should be investigated first; do not recommend spend changes yet.
Metric contracts:
- completed_order = distinct eligible order_id with final status completed
- reporting week = created_at week
- cancellation_rate = cancelled eligible orders / placed eligible orders
Data model:
orders = one row per order
customers = one row per customer
status_events = many rows per order
Before SQL:
1. Restate the question and required output grain.
2. Identify ambiguities and join risks.
3. Propose the analysis plan.
4. Write SQL in testable layers.
5. Provide control queries.
6. Separate observed findings from causal claims.Did the prompt include the decision, not only the metric?
Were metric definitions and time attribution explicit?
Did the model state the expected grain before joining?
Did it identify unknowns rather than invent them?
Can each major number be reconciled to a simpler control?
Does the final language distinguish observation from cause?
Frame the decision and write metric definitions.
Provide schema context and request an explicit plan.
Validate SQL, totals, edge cases and conclusions.
Keep only claims supported by checked evidence.
Treat AI-generated analysis like work from a very fast junior analyst: useful, inspectable, and never exempt from review.