Skip to content

From prompt to dashboard, without leaving Snowflake

I built a sales dashboard with Cortex Code, checked the numbers against SQL and found three changes that passed validation but failed in the preview.

DaAnalytics Sales Explorer dashboard showing sales filters, five KPI cards, a monthly revenue trend and a regional revenue bar chart.

A retail dashboard should help you decide where to look for lost sales or falling margins. That only works if everyone can see how revenue and margin are defined and which periods the dashboard compares. I built a sales dashboard with Snowflake Dashboards and Cortex Code (CoCo) to see how much of that work a prompt could handle.

The demo produced 29 tiles across four tabs. The totals I checked agreed with reference SQL, while several interactions and visuals needed hands-on testing. The most useful work happened before I asked CoCo to build a single chart.

What Snowflake Dashboards are

Snowflake listed Dashboards as an open preview on 1 December 2026. A dashboard is a .dash file in a Snowsight workspace. Charts, tables and Markdown sit on a 12-column grid. Data tiles use SQL to query a Snowflake warehouse. Snowflake Dashboards documentation

A few concepts matter for the rest of this post:

  • Filters are placeholders such as {{ filter('order_date') }} in tile SQL. Values are passed as query parameters, not pasted into the SQL text.
  • Hierarchies drive drill-down, through {{ hierarchy_key('geo') }} and {{ hierarchy_rows('geo') }}. Use both placeholders together so the drill level and displayed rows stay in sync.
  • Chart actions (click to filter, highlight) can only be added through CoCo, and only between tiles that query the same table or view.
  • Sharing happens by publishing the file as a read-only artifact. Viewers open it in Snowflake CoWork or Snowsight, and every tile runs with the viewer's own privileges (caller's rights).

The preview is distinct from Legacy Dashboards, which Snowflake started removing from Snowsight on 22 June 2026. Snowflake retirement notice

The demo: prepare first, prompt second

The demo setup had four parts. The repository includes the setup scripts, reference queries and prompts. Snowflake Dashboards demo repository

  1. A least-privilege demo user and role with its own warehouse and database, instead of building as SYSADMIN. The role needs SNOWFLAKE.CORTEX_USER to use CoCo in Snowsight (access requirements).
  2. A Git workspace on the repo, so the scripts run from Git and the finished .dash file is versioned next to them (Git workspaces).
  3. Synthetic sales data: a star schema for a fictional European retailer, 79 cities in 16 countries, about 3.7 million orders from January 2024 to October 2026, with five planted stories to find (a stock-out, a margin squeeze, a Black Friday deal that lost money).
  4. Two contracts on top of it: V_SALES, one wide view that every tile queries, and SV_SALES, a semantic view that defines what the metrics mean.

The semantic view records the business definitions. For example, gross margin percentage divides total margin by total revenue, and average order value uses distinct orders as its denominator.

METRICS (
  sales.net_revenue  AS SUM(NET_AMOUNT),
  sales.gross_margin AS SUM(MARGIN_AMOUNT),
  sales.orders       AS COUNT(DISTINCT ORDER_ID),
  gross_margin_pct   AS DIV0(sales.gross_margin, sales.net_revenue) * 100,
  avg_order_value    AS DIV0(sales.net_revenue, sales.orders)
)

The first prompt to CoCo built nothing. It asked CoCo to explore both views, report the grain and translate every metric in SV_SALES into SQL on V_SALES. Only after I agreed with that translation did the building start.

What Cortex Code built well

After about ten prompts, the DaAnalytics Sales Explorer had 4 tabs and 29 tiles, five dashboard filters (including a cascading Region > Country > City filter), drill-down on period, product and geography, and an expandable product table. What stood out was less the volume than the way CoCo worked.

It planned before it built. Every bigger change came as a plan to approve before any file was touched. That made it easy to steer, and easy to say no.

It reused the definitions instead of reinventing them. The "net revenue by month" line with a lighter previous-year line uses the two-argument form of the filter placeholder, shifting the date filter by a year:

WHERE {{ filter('order_date', 'DATEADD(year, 1, ORDER_DATE)') }}

That is exactly how SV_SALES defines "last year". CoCo didn't invent its own version.

It caught data problems before they became wrong numbers. Two examples. The cascading filter already used a hierarchy called geo, which clashed with the new drill hierarchy, so CoCo renamed the old one. And brand names turned out not to be unique: 8 brands, but 148 subcategory and brand pairs. Keyed on the name alone, a drill would have merged brands across subcategories. CoCo keyed the level on SUBCATEGORY || ' | ' || BRAND and kept showing just the brand.

The numbers held. Every geography drill level added up to the same €465,496,788.18 for the default period. The per-year and last-12-months KPIs matched my reference SQL exactly, and a "Top 25 cities" table with YoY % showed zero difference against the same metric queried through SEMANTIC_VIEW().

Where it needed help

The problems I encountered concerned chart interactions and rendering. Some only appeared when I opened the dashboard preview.

What I asked for What happened
Click a region bar to filter, and drill into it Conflict: on a drillable bar every click also drills, so the source chart changes. CoCo flagged it and let me choose. I kept a plain bar that filters every tab.
Click a category to highlight it elsewhere Partly: highlighting only works on tiles that return the clicked column. Drill tiles return LEVEL_KEY and LEVEL_LABEL, so they stayed untouched.
Two tiles filtering each other on channel Passed validation, then the whole dashboard showed "This dashboard failed to render". Removing one direction fixed it.
A point map of revenue by city Rendered. A Vega-Lite circle mark with a Mercator projection drew Europe from the city bubbles, without a basemap.
A choropleth of Dutch provinces from CBS/PDOK shapes Did not render. Only the colour legend showed, both with the GeoJSON as an object and as text.

Two of these deserve a closer look.

Maps. The docs say geospatial map chart types are not supported. Because the charts are Vega-Lite, I tested whether Vega-Lite's own map features would work anyway. Points with a projection did. Area shapes with geoshape, fed from SQL, did not: the data arrived (the legend had the right range), but no shapes were drawn. The legend showed that the tile received the values used for colour. I could not establish why it failed to draw the shapes. The point map was a result of this experiment, outside the documented map support.

Validation. Three changes passed the dashboard validator and still failed on screen: the province map, twice, and the two-way cross-filter. In this session, CoCo asked me for a screenshot to diagnose a rendering issue. I found it useful to make one change, validate it and inspect the preview before moving on.

In this session I used the Workspaces publishing controls: Publish artifact, choose the audience and grant viewing access. The publishing role needs MANAGE ACCESS ON DASHBOARD ARTIFACTS. Snowflake artifact sharing documentation

Why the semantic layer still comes first

CoCo had a concrete definition to work from each time I asked for a metric. The split between the two views mattered.

I used two contracts, and each did a different job:

  • SV_SALES defined meaning. What net revenue is, how margin percentage is weighted, what "last year" means, and rules such as "2026 is a partial year" and "don't split YoY by channel". CoCo carried those rules into every tile without being reminded.
  • V_SALES was the physical contract. Chart actions only work between tiles on the same table or view, so one wide view satisfied the common-source requirement. Tiles still needed the relevant column to participate in an action.

The dashboard tiles queried V_SALES, so their SQL still had to implement the definitions in SV_SALES. The semantic view gave me an independent query path for comparison. That distinction matters when either view changes. The same issue comes up when two analyses use different definitions of revenue. Same table, different revenue

The demo also exposed gaps in the questions the dashboard could answer. My data had five planted stories. A Germany stock-out and a loss-making Black Friday deal in Benelux were easy to find by clicking. But "Nordics had the highest growth" meant clicking region by region, because no tile ranked growth by region. And Spain's margin drop needed manual date juggling, because no tile showed margin over time. CoCo built what I asked for. The dashboard answered only the questions I had designed it for. The decision comes before the design, also when the designer is an AI.

Architecture perspective

Governance is designed in, if you place it right. A shared dashboard runs every tile with the viewer's own privileges, so two people can open the same link and see different numbers. That is a strong model, but it moves the security question to the data layer. Dashboard viewers need access to the data sources their tiles query. The demo's optional viewer-role setup puts a row access policy on the sales fact table shared by both query paths. When deploying this pattern, test both the dashboard and semantic-view queries under each intended viewer role. Snowflake guidance on querying semantic views

Cost follows the viewer. Caller's rights means each viewer's queries run on warehouse compute, with no shared query cache across viewers. For a handful of analysts that is fine. For hundreds of daily viewers, size the warehouse deliberately and keep tile queries lean: wide views and pre-aggregated tables earn their place here.

Dashboards become code. The .dash file lives in a Git workspace next to the SQL that feeds it. Git gives the team a history of changes to review and, when needed, revert. One catch from the docs: deleting, renaming or moving the source file breaks the link to the published artifact.

When I would choose something else:

  • Area maps or other visuals the tiles don't render: Streamlit in Snowflake is the more flexible option today.
  • Viewers outside your Snowflake account: artifact viewers sign in to the same account, so external reporting needs another route.
  • A mature BI estate with heavy self-service across sources that aren't in Snowflake: keep the BI layer where those workflows already run.
  • Production dashboards that must not change underneath you: wait until the feature is generally available.

Conclusion

I would start with a small internal dashboard over data that already lives in Snowflake. Pick one decision the dashboard should support, define the metrics and write reference queries. Then ask CoCo to build the tiles, compare the results and try the interactions as a viewer. The prompt gets the dashboard on screen. Those checks tell you whether it answers the question.

What would you move first from your BI tool into Snowflake, and what would you keep where it is?

References


Transparency note: AI assisted with editing and checking the article against Snowflake documentation and the local demo source.