<?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: Using aggregate functions in a map expression in Compose in Qlik Compose</title>
    <link>https://community.qlik.com/t5/Qlik-Compose/Using-aggregate-functions-in-a-map-expression-in-Compose/m-p/1734629#M119</link>
    <description>&lt;P&gt;The aggregate functions presented in Compose expression editors (for standard mappings to the DW model) are know as &lt;STRONG&gt;Window-ed analytic functions / windowed aggregates&lt;/STRONG&gt;.&amp;nbsp; &amp;nbsp;&amp;nbsp;Windowed analytical functions do not leverage a GROUP BY as they allow you to provide a set of data lower than the aggregate grain (the group by).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simple example from a query perspective would be a requirement to display all sales, with a sum of the total revenue for the entire day..&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp; - Select Date, Product, Acct, Qty, SUM(Quantity) OVER (Partition by Date) as DailyTotal from X&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this instance the PARTITION BY clause provides the WINDOW (acts similar to a group by) - but it is over the entire set of data.&amp;nbsp; &amp;nbsp;The data is not provided at the [DATE] grain, but the aggregate is.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recommend looking in the documentation for your data warehouse platform for Windowed Aggregates to understand what features are available in the dw platform as Compose will adhere / support what the platform provides.&lt;/P&gt;&lt;P&gt;If you're goal is to have a "simple" aggregate, Compose provides aggregated fact table support. (It is always a best practice in a DW to store data at the lowest granularity in the modeled layer and aggregate in the data marts).&amp;nbsp; &amp;nbsp;Having said that - there are commonly requirements to calculate and store an aggregate.&amp;nbsp; &amp;nbsp; If you are processing in batch, and wish to store / calculate an aggregate it is recommended to use &lt;EM&gt;query&amp;nbsp;&lt;/EM&gt; as the source for the mapping.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Aug 2020 20:07:09 GMT</pubDate>
    <dc:creator>TimGarrod</dc:creator>
    <dc:date>2020-08-10T20:07:09Z</dc:date>
    <item>
      <title>Using aggregate functions in a map expression in Compose</title>
      <link>https://community.qlik.com/t5/Qlik-Compose/Using-aggregate-functions-in-a-map-expression-in-Compose/m-p/1734622#M118</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to use a simple sum() function in one of my Compose maps as an expression. When I go to the Functions tab in the "Create Expressions" menu in the map, I found the following:&lt;/P&gt;&lt;P&gt;SUM({distinct|all} ${expr}) OVER({analytic_clause})&lt;/P&gt;&lt;P&gt;Hovering over this, it says it can be used as an aggregate or an analytic function. How do I use this as an aggregate function? Where do I put my group by clause? Where do I put the field name I want to return the sum of?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 20:49:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Compose/Using-aggregate-functions-in-a-map-expression-in-Compose/m-p/1734622#M118</guid>
      <dc:creator>jtompkins</dc:creator>
      <dc:date>2025-03-14T20:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggregate functions in a map expression in Compose</title>
      <link>https://community.qlik.com/t5/Qlik-Compose/Using-aggregate-functions-in-a-map-expression-in-Compose/m-p/1734629#M119</link>
      <description>&lt;P&gt;The aggregate functions presented in Compose expression editors (for standard mappings to the DW model) are know as &lt;STRONG&gt;Window-ed analytic functions / windowed aggregates&lt;/STRONG&gt;.&amp;nbsp; &amp;nbsp;&amp;nbsp;Windowed analytical functions do not leverage a GROUP BY as they allow you to provide a set of data lower than the aggregate grain (the group by).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simple example from a query perspective would be a requirement to display all sales, with a sum of the total revenue for the entire day..&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp; - Select Date, Product, Acct, Qty, SUM(Quantity) OVER (Partition by Date) as DailyTotal from X&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this instance the PARTITION BY clause provides the WINDOW (acts similar to a group by) - but it is over the entire set of data.&amp;nbsp; &amp;nbsp;The data is not provided at the [DATE] grain, but the aggregate is.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recommend looking in the documentation for your data warehouse platform for Windowed Aggregates to understand what features are available in the dw platform as Compose will adhere / support what the platform provides.&lt;/P&gt;&lt;P&gt;If you're goal is to have a "simple" aggregate, Compose provides aggregated fact table support. (It is always a best practice in a DW to store data at the lowest granularity in the modeled layer and aggregate in the data marts).&amp;nbsp; &amp;nbsp;Having said that - there are commonly requirements to calculate and store an aggregate.&amp;nbsp; &amp;nbsp; If you are processing in batch, and wish to store / calculate an aggregate it is recommended to use &lt;EM&gt;query&amp;nbsp;&lt;/EM&gt; as the source for the mapping.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 20:07:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Compose/Using-aggregate-functions-in-a-map-expression-in-Compose/m-p/1734629#M119</guid>
      <dc:creator>TimGarrod</dc:creator>
      <dc:date>2020-08-10T20:07:09Z</dc:date>
    </item>
  </channel>
</rss>

