March 4, 2026

Accelerating Enterprise-Grade AI Sales Assistant with Snowflake Cortex Code

By Cody Dirks

When a popular quick-service restaurant chain set out to build a talk-to-your-data sales assistant, the goal was straightforward but ambitious: let sales and finance stakeholders ask natural-language questions about the business, by store, region, product mix, promotion, and more, and get trustworthy answers in seconds.

Behind that seemingly simple experience sits a rich semantic model originally built for Power BI. To make the assistant work with Snowflake using Cortex Analyst and Cortex Agents, phData needed to bring that model into Snowflake as a first-class semantic layer and do so quickly enough to prove value within an eight‑week proof of concept (PoC).

Snowflake Cortex Code became a critical accelerator in that journey, helping the team translate, validate, and extend a complex semantic model significantly faster than a purely manual approach.

About the Customer

The customer is a leading fast‑casual restaurant brand with thousands of locations and a reputation for operational discipline, digital innovation, and data‑driven decision making.

Like many large restaurant organizations, their sales and finance teams rely on a wide range of KPIs to understand performance:

  • Same‑store sales and traffic trends

  • Mix shifts between in‑restaurant, digital pickup, and delivery

  • Promotion and campaign performance across regions and channels

  • Store‑level performance compared to plan and to peer groups

Before this project, much of that insight was delivered through curated dashboards backed by a robust Power BI semantic model. The next step was to move beyond static reports and give users a conversational way to explore the same governed metrics.

The Customer’s Challenge

To power a talk-to-your-data AI Sales Assistant on Snowflake, the customer powered with phData to curate a semantic layer that:

  • Matched the business logic and definitions already trusted in Power BI

  • Could be consumed reliably by Cortex Analyst and Cortex Agents

  • Would scale to new questions and use cases without constant rework

The starting point was a mature Power BI semantic model with:

  • 20+ interconnected tables

  • 200+ measures covering revenue, traffic, mix, promotions, and more

Existing tools like pbi-tools could export and bootstrap portions of that model, but several problems quickly surfaced:

  • Naming mismatches between Power BI artifacts and Snowflake tables/columns.

  • Syntax and edge‑case issues when translating definitions into Snowflake SQL and Semantic Views.

  • Eight‑week PoC window left little room for trial‑and‑error refactoring by hand.

The risk was clear: spending too much time untangling schema and measure translations would leave too little time to actually tune the AI assistant and validate business value with real users.

phData’s Solution: Using Cortex Code to Translate and Extend the Semantic Model

phData’s approach was to keep the trusted Power BI model as the source of truth for business logic, while rapidly standing up an equivalent Snowflake Semantic View that could serve Cortex Analyst and Cortex Agents.

Snowflake Cortex Code played a central role in three areas:

1. Debugging and Aligning the Data Model

After the initial export from Power BI, the team needed to ensure that every table and column reference aligned with Snowflake’s actual schemas.

Using Cortex Code, the team could:

  • Ask natural‑language questions to identify mismatched table and column references across the semantic view definitions.

  • Quickly spot where a measure was pointing at an outdated or renamed object.

  • Iterate on view definitions and immediately re‑run checks against live Snowflake metadata.

Instead of manually chasing down column names in dozens of files, engineers could rely on Cortex Code’s awareness of the Snowflake catalog to surface and fix discrepancies in minutes.

2. Translating and Validating Measures

The Power BI model contained hundreds of measures that needed to behave identically in Snowflake for business users to trust the assistant.

Cortex Code helped the team:

  • Translate complex calculations into Snowflake‑friendly SQL for Semantic Views.

  • Compare measure definitions across environments and flag potential behavior differences.

  • Generate candidate definitions for new or composite measures, which engineers then refine and validate.

This pattern, let Cortex Code propose, then have engineers review and harden,  meant the team could move quickly without sacrificing control over the most important business logic.

3. Identifying Opportunities to Pre‑Aggregate and Optimize

Conversational queries can span large time ranges and dimensional cuts (e.g., Compare last summer’s in‑restaurant comps vs. digital in the Southwest, broken out by major promotion).

To keep response times low and costs predictable, the team used Cortex Code to:

  • Analyze the emerging semantic view and identify places where pre‑aggregated tables or views would pay off.

  • Draft SQL for those supporting marts (for example, daily revenue and traffic summaries by store, channel, and promotion).

  • Iterate on these objects with immediate feedback on performance and correctness from Snowflake.

By combining Cortex Code’s code generation with phData’s data modeling patterns, the team quickly converged on a semantic layer that was both expressive and performant for agentic workloads.

Results

By integrating Cortex Code into the semantic modeling workflow, our co-development efforts saw meaningful acceleration and quality gains.

Faster Semantic Model Delivery

The team estimates a 2–3x speedup in semantic model development compared to a purely manual approach, driven by:

  • Less time spent tracking down schema mismatches and naming issues.

  • Faster translation and validation of complex measures.

  • Rapid scaffolding of new measures and supporting views based on real assistant queries.

That acceleration mattered: it allowed the team to ship more capability inside the same eight‑week PoC window, including additional measures and question patterns that would otherwise have been de‑scoped.

A Richer, More Trustworthy AI Sales Assistant

Because the Snowflake Semantic View stayed tightly aligned with the original Power BI model, the assistant could:

  • Answer a broader range of store, region, and promotion questions with confidence

  • Return numbers that matched what users already saw in their dashboards

  • Provide traceability back to underlying measures and tables, reinforcing trust with finance and analytics teams

In practical terms, sales and finance users can now ask questions like:

  • Show last quarter’s comparable sales by region, and highlight any stores more than 5% off plan.

  • How did digital pickup orders perform during our last national promotion compared to in‑restaurant?

They can also receive grounded answers powered by the same logic they rely on today, only now, through a conversational interface.

Better Dynamics Between Engineers and AI

Equally important, Cortex Code changed how the team worked:

  • Engineers focused more on What should this model represent? and less on Where did that column live again?

  • Code reviews focused on business logic, edge cases, and performance tuning rather than boilerplate.

  • The team built reusable prompts and patterns that they can apply to future semantic‑model‑driven projects on Snowflake

Cortex Code didn’t replace engineering judgment; it compressed the undifferentiated heavy lifting so that judgment could be applied where it mattered most.

Why This Matters

The AI Sales Assistant highlights a pattern many enterprises face:

  • Mature BI semantic models represent years of alignment on definitions and KPIs.

  • New AI and agentic experiences need that same semantic layer to avoid re‑litigating what revenue, traffic, or same‑store sales really mean.

Cortex Code provided a bridge between those worlds:

  • It helped preserve trusted business logic while moving to a Snowflake‑native semantic layer.

  • It accelerated the work required to make that layer usable by Cortex Analyst, Cortex Agents, and other AI applications.

For phData, this engagement reinforced that semantic‑aware AI assistants will increasingly depend on tools like Cortex Code to keep delivery timelines realistic while maintaining quality.

Looking Ahead

With the core semantic model in place on Snowflake and the AI Sales Assistant proving out its value, the door is open to:

  • Expand conversational analytics to additional business domains (operations, marketing, supply chain).

  • Continue enriching the semantic layer with new measures and aggregations driven by real user questions.

  • Re‑use the Cortex Code patterns from this project on future Snowflake and Cortex initiatives.

As more organizations look to bring talk‑to‑your‑data experiences to life, this journey shows how pairing Snowflake Cortex Code with a disciplined semantic modeling approach can turn a complex translation effort into a repeatable, high‑leverage pattern.

phData Blue Shield

Ready to unlock your own enterprise-grade AI sales assistant on Snowflake?

Reserve your spot in one of phData’s free, expert-led Snowflake Cortex Workshops to walk away with a concrete roadmap and next steps tailored to your data and semantic model.

Data Coach is our premium analytics training program with one-on-one coaching from renowned experts.

Accelerate and automate your data projects with the phData Toolkit