<?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: Aggr() function with master measures when values are missing??? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527224#M107360</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/293868"&gt;@EspenH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the behaviour of Aggr function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where there is a set analysis is used inside the Aggr function then same set should be repeated in outside aggr as well.&lt;/P&gt;&lt;P&gt;Try any of the below&lt;/P&gt;&lt;P&gt;Solution 1: (repeat the sets)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;min(&lt;BR /&gt;{$&amp;lt;Year={$(=max(Year)-1)}, Date={"&amp;gt;=$(=Min(AddYears(Date,-1))) &amp;lt;=$(=Max(AddYears(Date,-1)))"},Date = {"&amp;lt;=$(=Date(AddYears(Today(), -1)))"}&amp;gt; +&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;&amp;lt;Year={$(=max(Year))}, Date={"&amp;gt;=$(=Min(Date)) &amp;lt;=$(=Max(Date))"}, Date={"&amp;lt;=$(=Date(Today()))"} &amp;gt;&lt;/EM&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;aggr(Rangesum(Sales_CurrentPeriod, -1 * Sales_PreviousPeriod), Citiy))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Solution 2: (ignore all selections)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;min({1}aggr(Rangesum(Sales_CurrentPeriod, -1 * Sales_PreviousPeriod), Citiy))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Thanks&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Celambarasan&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Aug 2025 13:17:52 GMT</pubDate>
    <dc:creator>CELAMBARASAN</dc:creator>
    <dc:date>2025-08-13T13:17:52Z</dc:date>
    <item>
      <title>Aggr() function with master measures when values are missing???</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527219#M107358</link>
      <description>&lt;P&gt;I have created a master measure for this period and previous period sales:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Master measure: Sales_CurrentPeriod&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;Year={$(=max(Year))}, Date={"&amp;gt;=$(=Min(Date)) &amp;lt;=$(=Max(Date))"}, Date={"&amp;lt;=$(=Date(Today()))"} &amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Master measure: Sales_PreviousPeriod:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Year={$(=max(Year)-1)}, Date={"&amp;gt;=$(=Min(AddYears(Date,-1))) &amp;lt;=$(=Max(AddYears(Date,-1)))"},Date = {"&amp;lt;=$(=Date(AddYears(Today(), -1)))"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;I have created a filter with a drill down dimension containing Year, Month and date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the user choose a time periode like a year and one or several months the master measures above (Sales_CurrentPeriod and Sales_PreviousPeriod) calculates the chosen years sales and the sales for the same period the previous year. This is working fine.&lt;/P&gt;&lt;P&gt;In my data (table) I have a dimension for City.&lt;/P&gt;&lt;P&gt;Now i would like to create a KPI to find the max decline in sales between Cities between current and previous period, using the master measures Sales_CurrentPeriod and Sales_PreviousPeriod.&lt;/P&gt;&lt;P&gt;When i write the expression like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;min(aggr(Sales_CurrentPeriod - Sales_PreviousPeriod, Citiy))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I get the number for the City with the largest decline only where I have sales both in current and previous period. If I have a city where i have only sales in previous periode (which may be the biggest decline) the KPI does note show this, only the largest difference where i have sales in both periods.&lt;/P&gt;&lt;P&gt;I have tried to use alt() function like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;max(aggr(alt(Sales_CurrentPeriod,0) - alt(Sales_PreviousPeriod,0) , Citiy))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This is giving me the same result as the other expression.&lt;/P&gt;&lt;P&gt;It seems to be connected to the temp table created by the aggr() function when the master measure do not find any values in (the selected) current period.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a solution for this...?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Aug 2025 12:56:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527219#M107358</guid>
      <dc:creator>EspenH</dc:creator>
      <dc:date>2025-08-13T12:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function with master measures when values are missing???</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527224#M107360</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/293868"&gt;@EspenH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the behaviour of Aggr function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where there is a set analysis is used inside the Aggr function then same set should be repeated in outside aggr as well.&lt;/P&gt;&lt;P&gt;Try any of the below&lt;/P&gt;&lt;P&gt;Solution 1: (repeat the sets)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;min(&lt;BR /&gt;{$&amp;lt;Year={$(=max(Year)-1)}, Date={"&amp;gt;=$(=Min(AddYears(Date,-1))) &amp;lt;=$(=Max(AddYears(Date,-1)))"},Date = {"&amp;lt;=$(=Date(AddYears(Today(), -1)))"}&amp;gt; +&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;&amp;lt;Year={$(=max(Year))}, Date={"&amp;gt;=$(=Min(Date)) &amp;lt;=$(=Max(Date))"}, Date={"&amp;lt;=$(=Date(Today()))"} &amp;gt;&lt;/EM&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;aggr(Rangesum(Sales_CurrentPeriod, -1 * Sales_PreviousPeriod), Citiy))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Solution 2: (ignore all selections)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;min({1}aggr(Rangesum(Sales_CurrentPeriod, -1 * Sales_PreviousPeriod), Citiy))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Thanks&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Celambarasan&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Aug 2025 13:17:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527224#M107360</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2025-08-13T13:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function with master measures when values are missing???</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527225#M107361</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;Celambarasan, this is very much appreciated!!!&lt;/P&gt;&lt;P&gt;When you use both of the sets outside the aggr() function I guess the sets in the master measures filter what sets should be used, right?&lt;/P&gt;&lt;P&gt;Thank you again!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Aug 2025 13:45:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527225#M107361</guid>
      <dc:creator>EspenH</dc:creator>
      <dc:date>2025-08-13T13:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function with master measures when values are missing???</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527227#M107363</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/293868"&gt;@EspenH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, you are correct.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Celambarasan&lt;/P&gt;</description>
      <pubDate>Wed, 13 Aug 2025 13:57:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527227#M107363</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2025-08-13T13:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function with master measures when values are missing???</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527297#M107373</link>
      <description>&lt;P&gt;Hi Celambarasan&lt;/P&gt;&lt;P&gt;How can i find from which City the result are delivered?&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 06:34:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527297#M107373</guid>
      <dc:creator>EspenH</dc:creator>
      <dc:date>2025-08-14T06:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function with master measures when values are missing???</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527389#M107384</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/293868"&gt;@EspenH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you tried FirstSortedValue? Please refer below link to understand more about it.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Design/Don-t-get-aggr-avated-using-aggr/ba-p/1464136" target="_blank"&gt;Don't get aggr()avated using aggr() - Qlik Community - 1464136&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Celambarasan&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2025 02:13:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-function-with-master-measures-when-values-are-missing/m-p/2527389#M107384</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2025-08-15T02:13:18Z</dc:date>
    </item>
  </channel>
</rss>

