Discussed the BI & Metrics Tax elimination using Databricks Metric Views here. Semantic Layer is a core component of the lakehouse with Metric Views. Modern stack is moving toward ai data experiences where organizations ask questions instead of building large ad hoc queries & dashboards.
Semantic Layer belongs to the Lakehouse
Semantic layers resided in BI tools (Tableau, Power BI) & adhoc SQL tools creating fragmentations in the last decades. Organizations can define BI logic once by moving KPIs to metric view definitions into the lakehouse and use across the border.
Metric Views
Metric Views are governed metric objects registered in Unity Catalog helping Organizations as a semantic layer embedded in Lakehouse. AI BI Dashboards and Genie can now rely on the foundational metrics emitted via Metric Views in the Lakehouse. Organizations gain
- Consistent metrics across tools
- Strong governance and lineage
- Faster self analytics
Building Metric Views
Metric View has few core ingredients such as the fact source (table/view/sql), measures (calculations) and dimensions (region, sales year). Find the regional revenue metric view below
CREATE VIEW regional_revenue_metrics
WITH METRICS
LANGUAGE YAML
AS
version: 1.1
comment: "Standardized Regional Revenue KPIs for cross reporting"
source: sales.silver.orders_region -- Point to the table
dimensions:
- name: Transaction Year
expr: DATE_TRUNC ('YEAR', date)
- name: Market Segment
expr: segment
- name: Revenue Category
expr: |
CASE
WHEN price > 1000 THEN 'High Value'
WHEN price BETWEEN 1000 AND 10000 THEN 'Mid'
ELSE 'Standard'
END
measures:
- name: Gross Revenue
expr: SUM (price)
- name: Regional Order Volume
expr: COUNT (DISTINCT key)
- name: Average Deal Size
expr: SUM (price) / COUNT (key)
- name: Tax Impact
expr: SUM (price * (1 + tax))
Metric Views translates transaction data into business concepts (Gross Revenue, Regional Order Volume). The metrics can power AI/BI Dashboards or Databricks Genie. Organizations can create & expose high quality semantic metrics and dimensions to BI tools seamlessly.
Created the metric views part of a regional sales semantic layer & compatibility with AI BI stack is great.
Define metrics once - Organizations should maintain a single definition for key KPIs such as revenue, active users or conversion rate.
Semantic naming - Avoid column names such as cus_geo_rgn_cd. Expose clear dimensions such as customer_region.
KPI Metric - Semantic layer should focus on creating KPI logic and not complex transformations (ETL).