Skip to main content

Databricks Metric Views

Introduction

If a Databricks metric view already holds governed dimensions and measures, you can sync it into Holistics to build dashboards, implement embeds, and enable users to self-serve, without maintaining a duplicated definition.

Databricks metric view sync
  • Databricks Metric view — Dimensions and measures already governed in Databricks
  • Holistics
  • Model — Dimensions, measures, descriptions, and labels detected and synced automatically
  • Dataset — Add the synced model to a dataset to use it in reports
  • Dashboards
  • [HTML node]
  • metric-viewmodel
  • modeldataset (add to)
  • datasetdashboards (build)

How it works

At a high level, a Databricks metric view syncs into Holistics as a Table Model.

  • This is the metric view you define in Databricks:

    dimensions:
    - name: order_month
    expr: DATE_TRUNC('MONTH', o_orderdate)
    comment: First day of the order month
    measures:
    - name: total_revenue
    expr: SUM(o_totalprice)
    comment: Gross revenue before discounts
  • In Holistics, add a Table Model with that Databricks metric view. Once synced, Holistics automatically detects and syncs its measures, dimensions, descriptions, and labels. This is the resulting Holistics model:

    orders_metric_view.model.aml
    Model orders_metric_view {
    type: 'table'
    data_source_name: 'databricks'
    table_name: '"main"."default"."orders_metric_view"'

    dimension order_month {
    label: 'Order Month'
    type: 'datetime'
    description: 'First day of the order month'
    definition: @sql {{ #SOURCE.order_month }};;
    }

    measure total_revenue {
    label: 'Total Revenue'
    type: 'number'
    description: 'Gross revenue before discounts'
    definition: @sql AGG({{ #SOURCE.total_revenue }});;
    }
    }

    Here's what each part of the metric view mapped to in the generated model:

    In the metric viewIn the Holistics model
    dimensiondimension
    measuremeasure, wrapped in AGG(), aggregated by Databricks
    commentfield description
    display_namefield label (generated from the field name if there's no display_name)
  • Then, you can add it to a dataset to build internal dashboards or embedded analytics.

  • If the metric view's structure changes later (a field added, renamed, etc.), use Refresh Model to re-sync it.

Capabilities

CapabilitySupportDetails
Syncing
Sync
(Databricks → Holistics)
Detected dimensions, measures, descriptions, and labels automatically the first time the metric view is added as a Table Model.
Re-sync (Databricks → Holistics)⚠️
Manual
• If the metric view's structure changes in Databricks (a field added, renamed, etc.), in Holistics, use Refresh Model to update latest changes.
• Auto re-sync is not supported.
Write back (Holistics → Databricks)Changes made to the synced model's definition (fields, labels, etc.) in Holistics can't be pushed back to update the metric view in Databricks.
Reporting
Build dashboardUse dimensions & measures from synced model to build visualizations.
Use window measures⚠️ Workaround• Context: Holistics normally converts date fields to your org's timezone when grouping. But the window measure's ranking was calculated by Databricks using the date's raw value, so the two versions no longer match, and it'll break the report.
• Fix: duplicate the date field into a new dimension, set its type to text so it isn't converted, and use this new field on the report instead of the original.
Modeling
Build derived metricsBuild new metrics from the synced model's dimensions and measures, such as ratios and percent-of-total.
Period-over-period⚠️ Workaround• Context: the default calculation needs a join, which Databricks blocks.
• Fix: toggle "Show comparison period outside base range" in the comparison builder to work around it.
• Trade-off: one extra row appears at the end with a comparison value but no actual value.
Relationship in datasetDatabricks rejects any join that touches a metric view, so a synced model can't be linked to other models in a Holistics dataset.
SynonymsDatabricks metric views can define alternate names (synonyms) for a field. Holistics doesn't support this.
Data formatDatabricks metric views can define a display format (e.g. currency, percent) for a field. Holistics doesn't sync it into the field's data format.

Open Markdown
Let us know what you think about this document :)