<?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 Re: Metric Views + Window Functions not supported in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160184#M2629</link>
    <description>&lt;P&gt;The error occurs as nesting a window measure inside another window measure exceeds the functional boundaries&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jun 2026 05:11:21 GMT</pubDate>
    <dc:creator>balajij8</dc:creator>
    <dc:date>2026-06-23T05:11:21Z</dc:date>
    <item>
      <title>Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/149104#M2504</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/25346"&gt;@Hubert-Dudek&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;I am getting following error:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;METRIC_VIEW_WINDOW_FUNCTION_NOT _SUPPORTED The metric &lt;/SPAN&gt;&lt;SPAN class=""&gt;view&lt;/SPAN&gt; &lt;SPAN class=""&gt;is&lt;/SPAN&gt; &lt;SPAN class=""&gt;not&lt;/SPAN&gt;&lt;SPAN class=""&gt; allowed &lt;/SPAN&gt;&lt;SPAN class=""&gt;to&lt;/SPAN&gt;&lt;SPAN class=""&gt; use &lt;/SPAN&gt;&lt;SPAN class=""&gt;window&lt;/SPAN&gt; &lt;SPAN class=""&gt;function (...)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;With the following definition:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;- name: Sales net Total&lt;BR /&gt;- expr: SUM(MEASURE(`Sales net`)) OVER())&lt;/P&gt;&lt;P class=""&gt;However following query works fine:&lt;/P&gt;&lt;P class=""&gt;```&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;category&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MEASURE(&lt;/SPAN&gt;&lt;SPAN&gt;`Sales net`&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;sales_net,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(MEASURE(&lt;/SPAN&gt;&lt;SPAN&gt;`Sales net`&lt;/SPAN&gt;&lt;SPAN&gt;)) &lt;/SPAN&gt;&lt;SPAN&gt;OVER&lt;/SPAN&gt;&lt;SPAN&gt;()&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;AS sales_net_total&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FROM&lt;/SPAN&gt;&lt;SPAN&gt; sales_metric_view&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;GROUP BY&lt;/SPAN&gt; &lt;SPAN&gt;category&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ORDER BY&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;sales_net &lt;/SPAN&gt;&lt;SPAN&gt;DESC&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;```&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2026 20:21:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/149104#M2504</guid>
      <dc:creator>wrosa</dc:creator>
      <dc:date>2026-02-23T20:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/150199#M2523</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/217270"&gt;@wrosa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The error you are seeing (METRIC_VIEW_WINDOW_FUNCTION_NOT_SUPPORTED) is expected behavior. Metric views do not allow raw SQL window functions like SUM(...) OVER() directly in a measure's expr definition. This is by design because metric views use their own declarative window specification in the YAML definition rather than inline SQL window syntax.&lt;/P&gt;
&lt;P&gt;WHAT IS HAPPENING&lt;/P&gt;
&lt;P&gt;When you define a measure as:&lt;/P&gt;
&lt;P&gt;- name: Sales net Total&lt;BR /&gt;expr: SUM(MEASURE(`Sales net`)) OVER()&lt;/P&gt;
&lt;P&gt;The metric view engine rejects this because OVER() is standard SQL window function syntax, which is not permitted inside a measure expression. Measure expressions in metric views must be aggregate expressions (like SUM(), COUNT(), AVG(), etc.), optionally with FILTER clauses or arithmetic, but not SQL window functions.&lt;/P&gt;
&lt;P&gt;HOW TO ACHIEVE THE SAME RESULT&lt;/P&gt;
&lt;P&gt;You have two options depending on what you need.&lt;/P&gt;
&lt;P&gt;OPTION 1: USE THE METRIC VIEW WINDOW MEASURE YAML SYNTAX&lt;/P&gt;
&lt;P&gt;Metric views support "window measures" as a declarative feature. Instead of writing OVER() in the expr, you define a window block in the YAML. For example, if you want a grand total of Sales net across all rows, you would define it like this:&lt;/P&gt;
&lt;P&gt;measures:&lt;BR /&gt;- name: Sales net&lt;BR /&gt;expr: SUM(sales_net_column)&lt;BR /&gt;- name: Sales net Total&lt;BR /&gt;expr: SUM(sales_net_column)&lt;BR /&gt;window:&lt;BR /&gt;- order: &amp;lt;some_dimension&amp;gt;&lt;BR /&gt;range: all&lt;BR /&gt;semiadditive: last&lt;/P&gt;
&lt;P&gt;The "range: all" specification gives you the equivalent of OVER() (the entire dataset). The "order" field must reference one of your defined dimensions, and "semiadditive" controls how the value is summarized when that order dimension is not in the GROUP BY of your query.&lt;/P&gt;
&lt;P&gt;Here is a more concrete example. If you have a date dimension:&lt;/P&gt;
&lt;P&gt;dimensions:&lt;BR /&gt;- name: category&lt;BR /&gt;expr: category&lt;BR /&gt;- name: order_date&lt;BR /&gt;expr: order_date&lt;BR /&gt;measures:&lt;BR /&gt;- name: Sales net&lt;BR /&gt;expr: SUM(sales_net_column)&lt;BR /&gt;- name: Sales net Total&lt;BR /&gt;expr: SUM(sales_net_column)&lt;BR /&gt;window:&lt;BR /&gt;- order: order_date&lt;BR /&gt;range: all&lt;BR /&gt;semiadditive: last&lt;/P&gt;
&lt;P&gt;Then you would query it:&lt;/P&gt;
&lt;P&gt;SELECT&lt;BR /&gt;category,&lt;BR /&gt;MEASURE(`Sales net`) as sales_net,&lt;BR /&gt;MEASURE(`Sales net Total`) as sales_net_total&lt;BR /&gt;FROM sales_metric_view&lt;BR /&gt;GROUP BY category&lt;BR /&gt;ORDER BY sales_net DESC&lt;/P&gt;
&lt;P&gt;This gives you the per-category sales net alongside the grand total, similar to what SUM(...) OVER() would produce.&lt;/P&gt;
&lt;P&gt;Note: Window measures are currently an experimental feature. See the documentation for full details on available range options (current, cumulative, trailing, leading, all).&lt;/P&gt;
&lt;P&gt;OPTION 2: USE THE WINDOW FUNCTION AT QUERY TIME INSTEAD&lt;/P&gt;
&lt;P&gt;As you already discovered, you can use window functions in the query that reads from the metric view, just not inside the metric view definition itself:&lt;/P&gt;
&lt;P&gt;SELECT&lt;BR /&gt;category,&lt;BR /&gt;MEASURE(`Sales net`) as sales_net,&lt;BR /&gt;SUM(MEASURE(`Sales net`)) OVER() AS sales_net_total&lt;BR /&gt;FROM sales_metric_view&lt;BR /&gt;GROUP BY category&lt;BR /&gt;ORDER BY sales_net DESC&lt;/P&gt;
&lt;P&gt;This approach works because the OVER() is applied at query time after the metric view engine has resolved the MEASURE() calls. This is a perfectly valid pattern and may be simpler if you only need this calculation in one specific query.&lt;/P&gt;
&lt;P&gt;DOCUMENTATION REFERENCES&lt;/P&gt;
&lt;P&gt;Metric views overview:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/metric-views/" target="_blank"&gt;https://docs.databricks.com/aws/en/metric-views/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Window measures in metric views:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/metric-views/data-modeling/window-measures" target="_blank"&gt;https://docs.databricks.com/aws/en/metric-views/data-modeling/window-measures&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Creating metric views:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/metric-views/create/" target="_blank"&gt;https://docs.databricks.com/aws/en/metric-views/create/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In summary: the metric view definition language intentionally uses its own declarative window specification rather than SQL window function syntax. You can either define window measures in YAML using the window block, or apply standard SQL window functions at query time when reading from the metric view.&lt;/P&gt;
&lt;P&gt;* This reply used an agent system I built to research and draft this response based on the wide set of documentation I have available and previous memory. I personally review the draft for any obvious issues and for monitoring system reliability and update it when I detect any drift, but there is still a small chance that something is inaccurate, especially if you are experimenting with brand new features.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Mar 2026 07:39:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/150199#M2523</guid>
      <dc:creator>SteveOstrowski</dc:creator>
      <dc:date>2026-03-08T07:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/156314#M2569</link>
      <description>&lt;P&gt;Hi Steve, I have a similar problem , I am trying to translate the following query into yaml&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt; ATTRIBUTES&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; FechaReporte_Crm, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; zonaventa_CRM, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ClaseOperacionComercialId_Crm,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt;BusinessPartner_Crm,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt; MEASURES&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MEASURE&lt;/SPAN&gt;&lt;SPAN&gt;(ContadorReporte_Crm) &lt;/SPAN&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;SPAN&gt; ContadorReporte_Crm,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MEASURE&lt;/SPAN&gt;&lt;SPAN&gt;(Efectividad_CRM) &lt;/SPAN&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;SPAN&gt; Efectividad_CRM,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt; % DISTRIBUTION&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MEASURE&lt;/SPAN&gt;&lt;SPAN&gt;(ContadorReporte_Crm) * &lt;/SPAN&gt;&lt;SPAN&gt;100&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; / &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MEASURE&lt;/SPAN&gt;&lt;SPAN&gt;(ContadorReporte_Crm)) &lt;/SPAN&gt;&lt;SPAN&gt;OVER&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;PARTITION&lt;/SPAN&gt; &lt;SPAN&gt;BY&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt;-ATTRIBUTES IN SELECT LIST&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FechaReporte_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , zonaventa_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt; , ClaseOperacionComercialId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ) &lt;/SPAN&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;SPAN&gt; Pct_Distribucion_Abs_Crm,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt;-ATTRIBUTES IN SELECT LIST&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MEASURE&lt;/SPAN&gt;&lt;SPAN&gt;(Efectividad_CRM) * &lt;/SPAN&gt;&lt;SPAN&gt;100&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; / &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MEASURE&lt;/SPAN&gt;&lt;SPAN&gt;(Efectividad_CRM)) &lt;/SPAN&gt;&lt;SPAN&gt;OVER&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;PARTITION&lt;/SPAN&gt; &lt;SPAN&gt;BY&lt;/SPAN&gt;&lt;SPAN&gt; FechaReporte_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , zonaventa_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt;, ClaseOperacionComercialId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ) &lt;/SPAN&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;SPAN&gt; Pct_Distribucion_Efectividad_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;FROM&lt;/SPAN&gt; &lt;SPAN&gt;datalakekof_dev&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;comercial_vista&lt;/SPAN&gt;&lt;SPAN&gt;.com_vwm_crm_efectividad_mx&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WHERE&lt;/SPAN&gt; &lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;AND&lt;/SPAN&gt;&lt;SPAN&gt; zonaventa_CRM &lt;/SPAN&gt;&lt;SPAN&gt;IS NOT NULL&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;AND&lt;/SPAN&gt;&lt;SPAN&gt; FechaReporte_Crm &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;20260505&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;GROUP BY&lt;/SPAN&gt; &lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ORDER BY&lt;/SPAN&gt; &lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is how my yaml looks like:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;SPAN&gt;-FIX PROD CATALOG FROM PRD2 TO PRD&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CREATE OR REPLACE&lt;/SPAN&gt; &lt;SPAN&gt;VIEW&lt;/SPAN&gt; &lt;SPAN&gt;datalakekof_dev&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;comercial_vista&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;com_vwm_crm_efectividad_mx&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WITH&lt;/SPAN&gt; &lt;SPAN&gt;METRICS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LANGUAGE&lt;/SPAN&gt;&lt;SPAN&gt; YAML&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$$&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;version: 1.1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;source: &amp;nbsp;datalakekof_dev.comercial_vista.com_vw_crm_efectividad_mx&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;dimensions:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ReporteId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: ReporteId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Responsable_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: Responsable_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: BusinessPartner_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: BusinessPartner_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ClienteTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: ClienteTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: FlagCancelacion_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: FlagCancelacion_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: MedioIngreso_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: MedioIngreso_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Prioridad_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: Prioridad_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Canal_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: Canal_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Encuestador_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: Encuestador_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: CodigoProducto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: CodigoProducto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: FechaReporte_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: FechaReporte_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: RutaPreventa_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: RutaPreventa_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: NivelMercadeo_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: NivelMercadeo_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: UnidadOperativaId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: UnidadOperativaId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: UnidadOperativaId1_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: UnidadOperativaId1_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: AgenteOperadorId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: AgenteOperadorId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: AgenteOperadorTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: AgenteOperadorTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: NumeroParte_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: NumeroParte_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: EstadoReporteTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: EstadoReporteTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Dia&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: Dia&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Mes&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: Mes&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Filtro2_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: Filtro2_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Filtro1_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: Filtro1_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: PaisAbv_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: PaisAbv_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: GrupoVendedor_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: GrupoVendedor_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: GrupoOficina_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: GrupoOficina_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: DistribuidoraRepartoTexto_ECC&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: DistribuidoraRepartoTexto_ECC&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: RutaReparto_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: RutaReparto_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ZonaVenta_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: ZonaVenta_CRM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ZonaVentaTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: ZonaVentaTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ModoVenta_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: ModoVenta_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: AreaId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: AreaId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: MotivoId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: MotivoId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: MotivoTipoTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: MotivoTipoTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: MotivoCodigoId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: MotivoCodigoId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: MotivoTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: MotivoTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: CodigoGrupoTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: CodigoGrupoTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: MotivoGrupoId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: MotivoGrupoId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ClaseOperacionComercialId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: ClaseOperacionComercialId_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ClaseOperacionComercialTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: ClaseOperacionComercialTexto_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ClaseOperacionComercialTextoLargo_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: ClaseOperacionComercialTextoLargo_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;measures:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ContadorReporte_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: SUM(ContadorReporte_Crm) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: ContadorReporteResolucion_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: SUM(ContadorReporteResolucion_Crm) * 100&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; - name: Efectividad_Crm&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; expr: COALESCE(TRY_DIVIDE(ContadorReporteResolucion_Crm,ContadorReporte_Crm),0) &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$$&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;The tricky part here is that I am not able to dinamycally transalate the dimensions that participate in the PARTITION BY clause so I need to do it at the metric view level.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Also notice level of detail in PARTITION BY contains minus 1 column than in SELECT columns list, so when adding an extra column to SELECT, we need to have the same columns in PARTITION BY minus the one lastly added.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Do you have any idea how to achieve this behavior?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 May 2026 18:46:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/156314#M2569</guid>
      <dc:creator>lpolanco85</dc:creator>
      <dc:date>2026-05-06T18:46:31Z</dc:date>
    </item>
    <item>
      <title>Hi @lpolanco85, Good news: you can express this entirely...</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/157950#M2610</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/229397"&gt;@lpolanco85&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Good news: you can express this entirely inside the metric view. I reproduced your exact pattern (a percent-of-total whose PARTITION BY has one fewer column than the SELECT list) on a SQL warehouse and it works. The two pieces that unlock it are composable measures and a windowed expression that wraps MEASURE().&lt;/P&gt;
&lt;P&gt;TWO RULES THAT MAKE THIS WORK&lt;/P&gt;
&lt;P&gt;1. A measure's expr must be an aggregate, and to reference another measure you wrap it in MEASURE(). So your Efectividad measure should compose the two underlying measures rather than reference the raw columns directly:&lt;/P&gt;
&lt;PRE&gt;measures:
  - name: ContadorReporte_Crm
    expr: SUM(ContadorReporte_Crm)

  - name: ContadorReporteResolucion_Crm
    expr: SUM(ContadorReporteResolucion_Crm) * 100

  - name: Efectividad_Crm
    expr: COALESCE(TRY_DIVIDE(MEASURE(ContadorReporteResolucion_Crm),
                              MEASURE(ContadorReporte_Crm)), 0)&lt;/PRE&gt;
&lt;P&gt;2. For the percent-of-total columns, you can use SUM(MEASURE(x)) OVER (PARTITION BY ...) directly in the measure expr. The important detail I confirmed by testing: inside the OVER clause you reference the DIMENSION names, not the raw source columns. This is exactly what gives you the "PARTITION BY contains one fewer column than the SELECT" behavior you described, and you define it only once:&lt;/P&gt;
&lt;PRE&gt;measures:
  - name: Pct_Distribucion_Abs_Crm
    expr: MEASURE(ContadorReporte_Crm) * 100.0
        / SUM(MEASURE(ContadorReporte_Crm)) OVER (PARTITION BY FechaReporte_Crm, ZonaVenta_CRM)

  - name: Pct_Distribucion_Efectividad_Crm
    expr: MEASURE(Efectividad_Crm) * 100.0
        / SUM(MEASURE(Efectividad_Crm)) OVER (PARTITION BY FechaReporte_Crm, ZonaVenta_CRM)&lt;/PRE&gt;
&lt;P&gt;(FechaReporte_Crm and ZonaVenta_CRM here are the dimension names you defined in the dimensions block, not the underlying table columns.)&lt;/P&gt;
&lt;P&gt;HOW IT BEHAVES WHEN YOU QUERY IT&lt;/P&gt;
&lt;P&gt;With the measures defined once as above, the consumer query controls the level of detail and you never touch the metric view again:&lt;/P&gt;
&lt;PRE&gt;SELECT
  FechaReporte_Crm,
  ZonaVenta_CRM,
  ClaseOperacionComercialId_Crm,
  MEASURE(ContadorReporte_Crm)        AS ContadorReporte_Crm,
  MEASURE(Efectividad_Crm)            AS Efectividad_CRM,
  MEASURE(Pct_Distribucion_Abs_Crm)   AS Pct_Distribucion_Abs_Crm,
  MEASURE(Pct_Distribucion_Efectividad_Crm) AS Pct_Distribucion_Efectividad_Crm
FROM datalakekof_dev.comercial_vista.com_vwm_crm_efectividad_mx
WHERE ZonaVenta_CRM IS NOT NULL
  AND FechaReporte_Crm = '20260505'
GROUP BY ALL
ORDER BY 2;&lt;/PRE&gt;
&lt;P&gt;ClaseOperacionComercialId_Crm is in the SELECT, but the percent stays partitioned at the FechaReporte/ZonaVenta grain, so the distribution sums to 100 percent within each FechaReporte + ZonaVenta combination across all the Clase values. Add or remove a column in the SELECT and the partition stays fixed at the columns you named in the measure. In my test on sample data this produced exactly that result (percentages summing to 100 within each fixed partition).&lt;/P&gt;
&lt;P&gt;If instead you want the denominator to follow whatever the query groups on (a true "percent of the visible total"), use an empty window and the denominator recomputes at the query grain automatically:&lt;/P&gt;
&lt;PRE&gt;expr: MEASURE(ContadorReporte_Crm) * 100.0
    / SUM(MEASURE(ContadorReporte_Crm)) OVER ()&lt;/PRE&gt;
&lt;P&gt;TWO THINGS TO KEEP IN MIND&lt;/P&gt;
&lt;P&gt;- Reference dimension names (not raw source columns) inside PARTITION BY. Using the underlying table column there returns a grouping error, while the dimension name works.&lt;BR /&gt;
- Every dimension you list in PARTITION BY needs to be present in the query's GROUP BY. If you partition by FechaReporte_Crm and ZonaVenta_CRM, those two must be in the SELECT / GROUP BY of the query. Filters in the WHERE clause are applied before the window, so the percentages are computed over the filtered, visible rows.&lt;/P&gt;
&lt;P&gt;DOCS&lt;/P&gt;
&lt;P&gt;Composability (defining measures in terms of other measures with MEASURE()):&lt;BR /&gt;
&lt;A href="https://docs.databricks.com/aws/en/metric-views/data-modeling/composability" target="_blank"&gt;https://docs.databricks.com/aws/en/metric-views/data-modeling/composability&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Metric view YAML reference:&lt;BR /&gt;
&lt;A href="https://docs.databricks.com/aws/en/metric-views/yaml-ref" target="_blank"&gt;https://docs.databricks.com/aws/en/metric-views/yaml-ref&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Querying metric views (MEASURE(), GROUP BY ALL):&lt;BR /&gt;
&lt;A href="https://docs.databricks.com/aws/en/business-semantics/metric-views/query" target="_blank"&gt;https://docs.databricks.com/aws/en/business-semantics/metric-views/query&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This keeps everything in one metric view, defined once, with the query free to add or drop dimensions without you having to maintain a separate measure per partition shape. Hope that helps, and feel free to share your final YAML if you would like another set of eyes on it.&lt;/P&gt;
&lt;P&gt;* This reply used an agent system I built to research and draft this response based on the wide set of documentation I have available and previous memory. I personally review the draft for any obvious issues and for monitoring system reliability and update it when I detect any drift, but there is still a small chance that something is inaccurate, especially if you are experimenting with brand new features.&lt;/P&gt;
&lt;P&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;/P&gt;</description>
      <pubDate>Sat, 30 May 2026 01:29:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/157950#M2610</guid>
      <dc:creator>SteveOstrowski</dc:creator>
      <dc:date>2026-05-30T01:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160119#M2626</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/133188"&gt;@SteveOstrowski&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Having a table cards_daily_snapshot with columns time_key, month_id, account_id, card_id, credit_limit, account_status. Need to create a metric for total credit limit, by getting the max value of it per account_id and snapshot date (time_key). It should achieve similar result as in the query with a metric view.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;with cte as (&lt;BR /&gt;&amp;nbsp; &amp;nbsp; select time_key,month_id,account_id,max(credit_limit) as credit_limit&lt;BR /&gt;from&amp;nbsp;demo_cat.demo.cards_daily_snapshot&lt;BR /&gt;&amp;nbsp; &amp;nbsp; where 1=1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; and&amp;nbsp;account_status='A'&lt;BR /&gt;&amp;nbsp; &amp;nbsp; group by 1,2,3 &amp;nbsp;&lt;BR /&gt;)&lt;BR /&gt;select month_id, sum(credit_limit) as credit_limit from cte group by 1 order by 1;&lt;/P&gt;&lt;P&gt;I'm trying with a window measure which gets the credit_limit on account level, and then another measure which aggregates it across the data set. Getting an error during querying the aggregating measure&lt;BR /&gt;select &amp;nbsp;month_id,measure(credit_limit_agg) as lmt from demo_cat.demo.credit_card_metric_view&lt;BR /&gt;group by month_id;&lt;/P&gt;&lt;P&gt;[METRIC_VIEW_WINDOW_MEASURE_REFERENCES_WINDOW_MEASURE] Window measure `credit_limit_agg` cannot reference another window measure `account_credit_limit`. SQLSTATE: 0A000&lt;/P&gt;&lt;P&gt;My Yaml looks something like below:&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;measures:&lt;BR /&gt;- name: account_credit_limit&lt;BR /&gt;expr: MAX(credit_limit) FILTER(WHERE derived_account_status='A')&lt;BR /&gt;window:&lt;BR /&gt;- order: account_id&lt;BR /&gt;semiadditive: last&lt;BR /&gt;range: cumulative&lt;BR /&gt;- order: time_key&lt;BR /&gt;semiadditive: last&lt;BR /&gt;range: cumulative&lt;BR /&gt;display_name: Account Credit Limit&lt;BR /&gt;- name: credit_limit_agg&lt;BR /&gt;expr: sum(MEASURE(account_credit_limit)) over()&lt;BR /&gt;display_name: Total Credit Limit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2026 12:58:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160119#M2626</guid>
      <dc:creator>svetla87</dc:creator>
      <dc:date>2026-06-22T12:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160136#M2627</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/240080"&gt;@svetla87&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can follow below&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create the &lt;STRONG&gt;metric view&lt;/STRONG&gt; for MAX credit_limit per account/date (account_credit_limit).&lt;/LI&gt;&lt;LI&gt;Aggregate with SUM at query time using &lt;STRONG&gt;SQL&lt;/STRONG&gt; CTE or subquery pattern&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="python"&gt;-- Get MAX credit per account per day from metric view
WITH account_maxes AS (
  SELECT 
    month_id,
    time_key,
    account_id,
    MEASURE(account_credit_limit) as max_credit_limit
  FROM card_metric_view
  GROUP BY month_id, time_key, account_id
)
-- SUM across accounts to get monthly total
SELECT 
  month_id,
  SUM(max_credit_limit) as total_credit_limit
FROM account_maxes
GROUP BY month_id
ORDER BY month_id;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 22 Jun 2026 15:56:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160136#M2627</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-06-22T15:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160173#M2628</link>
      <description>&lt;P&gt;This definitely works, however I was trying to push all my KPIs to the semantic layer as this is a best practice recommendation. And on top of that once I manage to calculate total_credit_limit I have several more metrics such as utilization ratio, which are composite metrics calculated on top of other metric (averages, ratios, etc).&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm predominantly looking to have my full universe of KPIs defined as measures in the metric view.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2026 04:04:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160173#M2628</guid>
      <dc:creator>svetla87</dc:creator>
      <dc:date>2026-06-23T04:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160184#M2629</link>
      <description>&lt;P&gt;The error occurs as nesting a window measure inside another window measure exceeds the functional boundaries&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2026 05:11:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160184#M2629</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-06-23T05:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160605#M2630</link>
      <description>&lt;P&gt;Hi svetla87,&lt;/P&gt;
&lt;P&gt;Good instinct to push the full KPI universe into the semantic layer. You don't need window functions for composite metrics like a utilization ratio. Metric views support&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;composability&lt;/STRONG&gt;: a measure can reference other measures with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;MEASURE()&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function, so you can define your atomic measures once and then build ratios, conditional percentages, and growth rates on top of them. That keeps the whole KPI set living in the metric view as proper measures rather than as workarounds.&lt;/P&gt;
&lt;P&gt;Here is the shape of it, where&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;utilization_ratio&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is defined purely in terms of two other measures:&lt;/P&gt;
&lt;PRE&gt;version: 1.1
measures:
  - name: total_credit_limit
    expr: SUM(credit_limit)

  - name: total_balance
    expr: SUM(balance)

  - name: utilization_ratio
    expr: MEASURE(total_balance) / MEASURE(total_credit_limit)
    format:
      type: percentage
&lt;/PRE&gt;
&lt;P&gt;A few things worth knowing as you build out the rest of the set. A measure can reference base columns, earlier-defined fields, or earlier-defined measures, so order your definitions so each composite metric comes after the measures it depends on. For genuinely time-based metrics (trailing averages, period-over-period, cumulative totals) you would reach for window measures instead, via the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;window:&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;block with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;order&lt;/CODE&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;range&lt;/CODE&gt;, and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;offset&lt;/CODE&gt;. But for averages and ratios composed from other measures, plain composability is the recommended path and avoids the self-join cost that window measures carry.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Sources:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://docs.databricks.com/aws/en/business-semantics/metric-views/advanced-techniques" data-saferedirecturl="https://www.google.com/url?q=https://docs.databricks.com/aws/en/business-semantics/metric-views/advanced-techniques&amp;amp;source=gmail&amp;amp;ust=1782535206620000&amp;amp;usg=AOvVaw1Jcw0ZRrxO-fIUVp07itLd" target="_blank"&gt;Advanced techniques for metric views&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(composability, ratios, window measures)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://docs.databricks.com/aws/en/business-semantics/metric-views/basic-modeling" data-saferedirecturl="https://www.google.com/url?q=https://docs.databricks.com/aws/en/business-semantics/metric-views/basic-modeling&amp;amp;source=gmail&amp;amp;ust=1782535206620000&amp;amp;usg=AOvVaw3wFfR8VZ9EQMs1zH5h9E5J" target="_blank"&gt;Model metric views&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(measure syntax and referencing other measures)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://docs.databricks.com/aws/en/business-semantics/metric-views" data-saferedirecturl="https://www.google.com/url?q=https://docs.databricks.com/aws/en/business-semantics/metric-views&amp;amp;source=gmail&amp;amp;ust=1782535206620000&amp;amp;usg=AOvVaw0vK9TEWOSdFiP1UeIxyZnZ" target="_blank"&gt;Unity Catalog metric views&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(overview)&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 26 Jun 2026 04:46:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160605#M2630</guid>
      <dc:creator>SteveOstrowski</dc:creator>
      <dc:date>2026-06-26T04:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Metric Views + Window Functions not supported</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160606#M2631</link>
      <description>&lt;P&gt;Thanks balajij8, that matches what I have been seeing. To close the loop for anyone landing on this thread: the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;METRIC_VIEW_WINDOW_FUNCTION_&lt;WBR /&gt;NOT_SUPPORTED&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;error is expected behavior. Metric views do not accept raw SQL window functions (for example&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;SUM(...) OVER (...)&lt;/CODE&gt;) directly in a measure's&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;expr&lt;/CODE&gt;, and as balajij8 notes, you also cannot nest one window measure inside another, since that exceeds the boundaries of how window measures are evaluated.&lt;/P&gt;
&lt;P&gt;The supported path is to express the running/trailing/period-over-&lt;WBR /&gt;period logic with the declarative&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;window:&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;construct on the measure rather than an&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;OVER()&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;clause. You keep a plain aggregate in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;expr&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and describe the frame separately:&lt;/P&gt;
&lt;PRE&gt;measures:
  - name: cumulative_sales
    expr: SUM(o_totalprice)
    window:
      - order: date
        range: cumulative
        semiadditive: last&lt;/PRE&gt;
&lt;P&gt;&lt;CODE&gt;range&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;accepts&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;current&lt;/CODE&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;cumulative&lt;/CODE&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;trailing N day/month&lt;/CODE&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;leading N day/month&lt;/CODE&gt;, or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;all&lt;/CODE&gt;, and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;offset&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(for example&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;offset: -12 month&lt;/CODE&gt;) handles year-over-year style comparisons. For the case where you genuinely need a window applied on top of another window result, the workaround is to materialize the inner window measure first (a base metric view or a precomputed table/column) and then define the outer window measure against that, rather than nesting the two in one definition.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Sources:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://docs.databricks.com/aws/en/business-semantics/metric-views/advanced-techniques" data-saferedirecturl="https://www.google.com/url?q=https://docs.databricks.com/aws/en/business-semantics/metric-views/advanced-techniques&amp;amp;source=gmail&amp;amp;ust=1782535206626000&amp;amp;usg=AOvVaw2bazMTypVcj4mps24z1bOV" target="_blank"&gt;Advanced techniques for metric views (window measures)&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://docs.databricks.com/aws/en/error-messages/error-classes" data-saferedirecturl="https://www.google.com/url?q=https://docs.databricks.com/aws/en/error-messages/error-classes&amp;amp;source=gmail&amp;amp;ust=1782535206626000&amp;amp;usg=AOvVaw1U6CnhR_LUGQAwXKiJEhoc" target="_blank"&gt;Error conditions in Databricks (METRIC_VIEW_WINDOW_FUNCTION_&lt;WBR /&gt;NOT_SUPPORTED)&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 26 Jun 2026 04:46:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/metric-views-window-functions-not-supported/m-p/160606#M2631</guid>
      <dc:creator>SteveOstrowski</dc:creator>
      <dc:date>2026-06-26T04:46:25Z</dc:date>
    </item>
  </channel>
</rss>

