Skip to Content

Model

Edit model definitions

Add tables and metrics yourself, inspect their results, and define joins in Graph.

Add tables and metrics yourself, then check their results before publishing.

Add a metric

  1. Open your semantic model in Grid.

  2. Select Pick tables if the model has no tables.

  3. Select the physical tables your model needs.

  4. Select Add 1 table, or the button with your selected table count.

  5. Select Grid.

  6. Select Metric beside the plus icon.

    Semantic model Grid view of Subscription metrics with the Metric button highlighted at the right of the filter bar.
    Metric adds a new metric definition to the model.
  7. Enter the Name.

  8. Choose the Calculation.

    Revenue metric definition with the Sum calculation select highlighted, followed by amount, subscription_orders and order_date.
    Calculation reads as a sentence: Sum of amount in subscription_orders by order_date.
  9. Choose the Table.

  10. Choose the Column when the calculation requires it.

  11. Choose the Date column for a metric over time.

  12. Select Run in Preview.

    Preview panel under the Revenue definition with the Run button highlighted.
    Run checks the definition on real rows.

The preview shows the result from your source. Correct field errors before running again.

The Key identifies the definition. Changing it can affect definitions that reference it. Use a business name for the label and a stable key for references.

For a table, One row is describes its grain. Dated by identifies its date column.

Check the result

  1. Open Checks beside Preview.

    Preview panel with the Checks tab highlighted, showing 1 of 3, next to Preview and Used in.
    Checks shows how many checks the definition passes.
  2. Read whether the definition is valid, runs on real rows, and previews as in a workbook.

  3. Open Used in to inspect dependencies before changing a shared definition.

Use Show SQL from the preview menu to inspect the generated query. Use Stop to stop waiting for a running query. The warehouse may still finish it. After a draft or customer change, Run again refreshes the checks for that scope.

Edit in Code

  1. Select Code.

  2. Select the definition file in the file tree.

    Code view with revenue.yaml highlighted in the file tree and its YAML open: name, label, description, agg, column and date_column.
    Code shows each definition as a YAML file.
  3. Edit its YAML.

  4. Resolve the problems shown beneath the editor.

  5. Run the affected metric again.

Code and Grid edit the same draft. A draft edit does not change the published model.

Add another table

  1. Select Code.
  2. Expand Warehouse catalog in the file tree.
  3. Select the physical table.
  4. Select Add to model.

Define a join

Add both tables to the model before defining their join.

  1. Select Graph.
  2. Drag from one table’s column dot to the matching column dot on another table.
  3. Select Choose columns yourself to inspect or change the column pairs.
  4. Use Add column pair if the relationship needs multiple columns.
  5. Select which rows to keep.
  6. Choose Expected matches from your business rule.
  7. Select Check row effects.
  8. Read the matching rows and possible row loss or multiplication.
  9. Select Add join only when the relationship is correct.

Close the join card to discard an unsaved join. Use Undo after adding a join to reverse that draft change. Open an existing join to edit it, then select Save join.

If Bryn proposed the join, select Review changes. Read every included definition before accepting. A proposal can include other joins and metrics. Review the full proposal.

Row effects describe the rows checked. They are not a guarantee about every row in your datasource.

Next, check and publish the model.

On this page