<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Can metric views be used to achieve sql cube functionality in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154318#M54078</link>
    <description />
    <pubDate>Mon, 13 Apr 2026 11:43:39 GMT</pubDate>
    <dc:creator>IM_01</dc:creator>
    <dc:date>2026-04-13T11:43:39Z</dc:date>
    <item>
      <title>Can metric views be used to achieve sql cube functionality</title>
      <link>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154318#M54078</link>
      <description />
      <pubDate>Mon, 13 Apr 2026 11:43:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154318#M54078</guid>
      <dc:creator>IM_01</dc:creator>
      <dc:date>2026-04-13T11:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can metric views be used to achieve sql cube functionality</title>
      <link>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154321#M54079</link>
      <description>&lt;H3&gt;&lt;FONT size="3"&gt;Metric Views is not a direct cube engine. It's a semantic abstraction layer. It allows to define dimensions, fact, measures with aggregations and then query it flexibly across tools.&lt;/FONT&gt;&lt;/H3&gt;&lt;H3&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;STRONG&gt;You get multiple choices&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;&lt;H3 id="toc-hId-614828801"&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Star Schema Approach&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/H3&gt;&lt;P&gt;&lt;FONT size="3"&gt;Adopt a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;star schema&lt;/STRONG&gt;&amp;nbsp;(Fact &amp;amp; Dimension along with joins in metric views) design as it s&lt;/FONT&gt;implifies metric view creation with easier governance and extensibility&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Modular Metric Views-&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;Create&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;separate &lt;/STRONG&gt;modular metric views&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;based on purpose (&lt;/SPAN&gt;&lt;STRONG&gt;Sales by State&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;- Metric View with a&amp;nbsp;join between sales and state dimension,&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;Sales by Maker -&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;Metric view with&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;a join between sales and product dimension).&amp;nbsp;&lt;FONT&gt;It a&lt;/FONT&gt;&lt;FONT&gt;ligns well with domain driven design and easy to manage&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT&gt;More details &lt;A href="https://community.databricks.com/t5/community-articles/solving-multi-dimension-analytics-in-databricks-dashboards-with/td-p/152340" target="_self"&gt;here&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 12:38:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154321#M54079</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-04-13T12:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can metric views be used to achieve sql cube functionality</title>
      <link>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154327#M54081</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/193958"&gt;@IM_01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Yes. Metric views are explicitly designed to give you SQL cube-like behaviour.&lt;/P&gt;
&lt;P&gt;A metric view lets you define measures once, independent of dimensions, then aggregate those measures over any combination of dimensions at query time, which is the core behaviour you get from cubes.&lt;/P&gt;
&lt;P&gt;When querying a metric view, you can use GROUP BY GROUPING SETS (and thus CUBE/ROLLUP patterns) on its dimensions, so you can generate detail rows, subtotals, and grand totals in a single query, just like with GROUP BY CUBE.&lt;/P&gt;
&lt;P&gt;The main difference vs. a classic OLAP cube is that metric views are SQL/UC-native and compute aggregations on demand (optionally with materialization for performance), rather than maintaining a separate multidimensional cube engine.&lt;/P&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 13:41:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154327#M54081</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-04-13T13:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can metric views be used to achieve sql cube functionality</title>
      <link>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154340#M54083</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/216690"&gt;@Ashwin_DSA&lt;/a&gt;&amp;nbsp; could you please provide an example .&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 14:28:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154340#M54083</guid>
      <dc:creator>IM_01</dc:creator>
      <dc:date>2026-04-13T14:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can metric views be used to achieve sql cube functionality</title>
      <link>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154361#M54087</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/193958"&gt;@IM_01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Here is a simple example..&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;%sql
CREATE SCHEMA IF NOT EXISTS uc_customer_demo_catalog.metric_demo;

CREATE OR REPLACE TABLE uc_customer_demo_catalog.metric_demo.orders (
  order_id   INT,
  order_date DATE,
  country    STRING,
  product    STRING,
  revenue    DOUBLE
);

INSERT INTO uc_customer_demo_catalog.metric_demo.orders VALUES
  (1, '2025-01-01', 'US', 'Laptop', 1200.0),
  (2, '2025-01-02', 'US', 'Laptop',  800.0),
  (3, '2025-01-03', 'US', 'Phone',   500.0),
  (4, '2025-01-01', 'UK', 'Laptop', 1000.0),
  (5, '2025-01-02', 'UK', 'Phone',   400.0),
  (6, '2025-01-03', 'UK', 'Phone',   600.0),
  (7, '2025-01-04', 'DE', 'Laptop',  700.0),
  (8, '2025-01-04', 'DE', 'Phone',   300.0);&lt;/LI-CODE&gt;
&lt;P&gt;Created a metric view as below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="metric_view.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/25951iC19C50C919BA86D3/image-size/large?v=v2&amp;amp;px=999" role="button" title="metric_view.png" alt="metric_view.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;And here is the query I used..&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;SELECT
  country,
  product,
  MEASURE(total_revenue) AS total_revenue
FROM uc_customer_demo_catalog.metric_demo.orders_metric_view
GROUP BY GROUPING SETS (
  (country, product),
  (country),
  (product),
  ()
)
ORDER BY country, product;&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ashwin_DSA_0-1776098623292.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/25952i477FA2A74B3B416C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ashwin_DSA_0-1776098623292.png" alt="Ashwin_DSA_0-1776098623292.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Does this give you an idea?&lt;/P&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 16:44:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154361#M54087</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-04-13T16:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can metric views be used to achieve sql cube functionality</title>
      <link>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154469#M54105</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/216690"&gt;@Ashwin_DSA&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for the example . So it abstracts the logic of metrics can we make the group by cols dynamic actually the scenario is dynamically based on filters like - all or specific cols selection calculate metrics. So is it good to go with metric views or should I calculate &amp;amp; persist the metrics as table columns could you please suggest&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2026 16:45:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154469#M54105</guid>
      <dc:creator>IM_01</dc:creator>
      <dc:date>2026-04-14T16:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can metric views be used to achieve sql cube functionality</title>
      <link>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154470#M54106</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/193958"&gt;@IM_01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You define the metric logic once (measures) and a set of dimensions.&amp;nbsp;At query time, you can group by any subset of those dimensions (or none), so your "All" case (no group by), "group by 1 column", "group by 3 columns", etc.,&amp;nbsp;are all just different SQL queries over the same metric view.&lt;/P&gt;
&lt;P&gt;Example patterns over the same metric view:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;-- Grand total (like "All")
SELECT MEASURE(total_revenue) FROM uc_customer_demo_catalog.metric_demo.orders_metric_view;

-- Group by whatever dimensions the user selected
SELECT
  country,
  MEASURE(total_revenue)
FROM uc_customer_demo_catalog.metric_demo.orders_metric_view
GROUP BY country;

SELECT
  country,
  product,
  MEASURE(total_revenue)
FROM uc_customer_demo_catalog.metric_demo.orders_metric_view
GROUP BY country, product;
&lt;/LI-CODE&gt;
&lt;P class="p8i6j01 paragraph"&gt;So for a UI where users can change filters and choose any combination of dimensions, metric views are the recommended approach. They keep your metric definitions centralized and let the UI/SQL decide the group-by dynamically.&lt;/P&gt;
&lt;P&gt;You only need to pre-calculate and persist aggregates in tables when you have a small, fixed set of aggregates and you need very tight latency and are happy to manage extra tables.&lt;/P&gt;
&lt;P&gt;Even then, Databricks also offers metric view materialization (pre-aggregated views behind the scenes) so you can keep the semantic layer clean and still get performance.&lt;/P&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2026 16:59:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-metric-views-be-used-to-achieve-sql-cube-functionality/m-p/154470#M54106</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-04-14T16:59:57Z</dc:date>
    </item>
  </channel>
</rss>

