Skip to main content
Use a semantic view to define how tables relate and how business metrics should be calculated. Start with one metric and a dimension so you can compare the result with a query you already trust.

1. Define the business model

Identify the source tables, join keys, and the grain of the result. Check that the key on the dimension side is unique. Then define the relationships, dimensions, and metric expression in CREATE SEMANTIC VIEW.

2. Query a metric by dimension

Select the metrics and dimensions by their model names in a semantic view query. For a first check, use the same filters and grouping as the equivalent query on the source tables.

3. Verify the result and inspect the definition

Compare the rows and totals with the equivalent SQL. If the results differ, use EXPLAIN SNOWFLAKE to inspect the model relationships and EXPLAIN INLINE to see the expanded SQL. Use SHOW CREATE SEMANTIC VIEW to check the stored definition. Follow the worked example to model and query order revenue by customer. To trace the tables and columns behind a model, see semantic view lineage.