AI-Powered Analytics
AI Integration

AI-Powered Analytics

Client: Regional Retail Group · Year: 2025 · Status: Completed · Service: AI Integration

A regional retail group sat on years of transactional data — but every new question still meant a ticket to the BI team. Dashboards answered yesterday’s KPIs; they did not help a store manager ask “Why did margin drop in Q3 for Category X?” in plain language.

The challenge

Analysts were the bottleneck. SQL reports were accurate but slow to change. Leadership wanted self-serve insights without opening the door to hallucinated numbers or leaked PII.

  • 50+ legacy SQL reports with overlapping metrics
  • No shared business glossary — “active customer” meant three things
  • Managers exported CSVs to Excel for ad-hoc cuts
  • Compliance required query audit trails
Analytics dashboard on a monitor
Curated semantic layer: one definition per metric before any model saw production data.

Our approach

We shipped a phased RAG assistant — retrieval-first, generation second. Answers cite source tables and time ranges. Access tiers mirror existing BI roles; prompts that request restricted fields are blocked at the gateway.

Phase 1 — Data foundation

  • Inventory of reports → canonical metrics document
  • Read-only warehouse views with row-level security
  • Embedding index over approved question/answer pairs and schema docs
Developer reviewing code on multiple screens
Guardrails tested against 200+ red-team prompts before pilot launch.

Phase 2 — Assistant UX

A lightweight web app: chat thread, cited SQL snippets (read-only), export to PDF/CSV. Vietnamese and English prompts supported. “I don’t know” is a valid answer when retrieval confidence is low.

Team in an open office reviewing insights
Pilot with Operations; expand to Merchandising after prompt tuning.

Technical highlights

  • Vector store over glossary + sample queries, not raw PII tables
  • LLM generates SQL → validated against allow-list → executed read-only
  • Every answer stores prompt, retrieval IDs, and result hash for audit
  • Rate limits and cost caps per department

Outcomes

  • Managers get same-day answers for 70% of recurring questions
  • Analyst hours reallocated to forecasting and data quality work
  • Audit-friendly logs passed internal compliance review
  • Playbooks and prompt library reduced “bad question” frustration
“It feels like having a patient analyst in the room — but one that always shows its homework.”

What’s next

Phase 3 adds scheduled insight digests and optional Slack delivery. We left hooks for fine-tuned models but recommend staying retrieval-heavy until data governance matures.