Skip to content

Use Snowflake semantic metrics in Tableau

Semantic Hub can generate a Snowflake semantic view and a Tableau data source that consumes its numeric metrics. Snowflake owns the calculations, including distinct counts, ratios and supported period comparisons. Tableau selects dimensions and displays the results.

Use this route when the database should own the business definitions. Setting deployments.DATABASE.semantic_layer to false, or omitting it, keeps the existing Tableau source over database tables. Databricks metric-view consumption is not yet available.

Generate and connect

  1. Download the orders example catalog and example source-column metadata. The catalog reads Snowflake's TPC-H sample ORDERS table. Replace the server, role, warehouse and destination namespace with your settings. The metadata file describes logical types and nullability; your integration supplies these through its source-schema provider.
  2. Keep semantic_layer: true on the model's DATABASE deployment. Select SNOWFLAKE_SEMANTIC_VIEW explicitly to generate the view, and TABLEAU_TDS explicitly to generate its Tableau consumer. Compilation produces files without connecting to either service.
  3. Review and deploy semantic-view.sql to the destination database and schema. Each DDL statement has a standalone -- @SQL: marker. The deployment account needs permission to create the semantic view and read its underlying sources.
  4. Open Model.tds, or the starter Model.twb, in Tableau. Configure the Snowflake credential in Tableau, using an account and role allowed to query the deployed view. Credentials are supplied separately from generated artifacts. The starter workbook contains a blank sheet so that you can choose a valid metric/dimension combination.
  5. Start with status on Rows and one metric on Text. Use the generated aggregate calculations as supplied. Do not replace a distinct count, average or ratio with a sum of displayed groups.

The example's source tables remain in SNOWFLAKE_SAMPLE_DATA.TPCH_SF1, while its semantic view is deployed to ANALYTICS.SEMANTIC. The Tableau source reads the destination view. Generating a Tableau source does not deploy that view.

Global results and nonadditive totals

For a global KPI, put the example's all_orders dimension on Rows and the desired metric on Text. Its authored expression is 1, so it retains a grouping dimension while asking Snowflake to evaluate the complete population.

For a subtotal across statuses, put all_orders followed by status on Rows, put one metric on Text, and enable the subtotal for all_orders. This keeps the outer dimension in the total query. Live tests checked the actual exported subtotal for distinct customers, average order value and revenue per customer against independent SQL. The distinct customer subtotal was 99,996; adding the status counts would incorrectly give 230,540.

Native grand totals that remove every dimension failed with Snowflake's Invalid metric expression 'COUNT(1)' error in these tests. Use the grouped KPI or qualified subtotal pattern above. The compiler does not add an all_orders dimension to your models automatically. More complex subtotal layouts need their own verification. See Snowflake's Tableau limitations.

Show a month without removing its history

The example's previous_revenue and revenue_change use the previous calendar month, within each status. Put the canonical month dimension and status on Rows. Keep the months needed for lookback in the source query.

An ordinary source filter that selects only February 1995 removes January before the period calculation runs. Live tests then returned NULL for both period metrics. To show February while retaining history, the verified workbook used this display-only Tableau table calculation as a filter:

LOOKUP(ATTR([month]), 0) = #1995-02-01#

Keep month and status in the view and retain the full input history. Apply the calculation after aggregation, using the view's row order, and filter to True. This calculation controls visibility; it does not calculate revenue or the period comparison. In the tested monthly status layout, February's previous values matched January's independently aggregated revenue. Verify the addressing and partitioning if you change the layout. See Tableau table calculations.

Publication and current limits

The qualified native workbooks used an embedded copy of the generated Snowflake source. Publishing the .tds and retrieving its field metadata also worked. A workbook consuming that separately published source has not passed native metric execution; it must not yet be treated as a qualified shared-source workflow.

Tableau's VizQL Data Service does not support the RAWSQL aggregate calculations used by this adapter. Native workbook queries are required to verify the displayed values; successful publication or metadata retrieval alone does not prove query support. See VDS limitations.

The example was checked with live Snowflake and Tableau Cloud connections. Currency comparisons use the authored two-decimal display format. This establishes the tested layouts and metric combinations, not arbitrary workbook, total, filter, security or connector behavior. Empty filtered worksheets can show no marks instead of a numeric zero.