<?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 aggr and rank in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533299#M108201</link>
    <description>&lt;P&gt;Hi &lt;SPAN&gt;Everyone&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;In Qlik Sense, I have a pivot table with two dimensions: Store and Item.&lt;BR /&gt;I would like to write an expression that, at the Store dimension level, counts the number of Items that are not sold in the Store but are among the 100 best-selling items across all stores.&lt;BR /&gt;Instead, in the rows where the Item dimension is exploded, I would like it to show the Item with a measure value of 1 if the Item has not been sold but is among the top 100 across all stores.&lt;BR /&gt;I wrote the following expression, but it is incorrect.&lt;/P&gt;&lt;P&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;// Item NOT sold in Store&lt;BR /&gt;sum(Sales)=0&lt;BR /&gt;AND&lt;BR /&gt;// Item in Top 100 throughout the entire store network&lt;BR /&gt;rank(sum(TOTAL &amp;lt;Item&amp;gt; {&amp;lt; Store= &amp;gt;} Sales), 4) &amp;lt;= 100,&lt;BR /&gt;1, 0&lt;BR /&gt;),&lt;BR /&gt;Store, Item&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;I believe the problem lies in the fact that rank() is not calculated at the Item level and Items are not sorted based on rank().&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;stefano&lt;/P&gt;</description>
    <pubDate>Mon, 13 Oct 2025 17:01:12 GMT</pubDate>
    <dc:creator>stefano_marson</dc:creator>
    <dc:date>2025-10-13T17:01:12Z</dc:date>
    <item>
      <title>aggr and rank</title>
      <link>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533299#M108201</link>
      <description>&lt;P&gt;Hi &lt;SPAN&gt;Everyone&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;In Qlik Sense, I have a pivot table with two dimensions: Store and Item.&lt;BR /&gt;I would like to write an expression that, at the Store dimension level, counts the number of Items that are not sold in the Store but are among the 100 best-selling items across all stores.&lt;BR /&gt;Instead, in the rows where the Item dimension is exploded, I would like it to show the Item with a measure value of 1 if the Item has not been sold but is among the top 100 across all stores.&lt;BR /&gt;I wrote the following expression, but it is incorrect.&lt;/P&gt;&lt;P&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;// Item NOT sold in Store&lt;BR /&gt;sum(Sales)=0&lt;BR /&gt;AND&lt;BR /&gt;// Item in Top 100 throughout the entire store network&lt;BR /&gt;rank(sum(TOTAL &amp;lt;Item&amp;gt; {&amp;lt; Store= &amp;gt;} Sales), 4) &amp;lt;= 100,&lt;BR /&gt;1, 0&lt;BR /&gt;),&lt;BR /&gt;Store, Item&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;I believe the problem lies in the fact that rank() is not calculated at the Item level and Items are not sorted based on rank().&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;stefano&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 17:01:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533299#M108201</guid>
      <dc:creator>stefano_marson</dc:creator>
      <dc:date>2025-10-13T17:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: aggr and rank</title>
      <link>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533308#M108203</link>
      <description>&lt;P&gt;Try this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; Aggr(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; If(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Sum(Sales) = 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; AND Rank( TOTAL Sum( {1} Sales ) ) &amp;lt;= 100,&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1,&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; ),&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp; &amp;nbsp; Store, Item&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 18:33:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533308#M108203</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2025-10-13T18:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: aggr and rank</title>
      <link>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533361#M108205</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/44183"&gt;@stefano_marson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/49432"&gt;@Chanty4u&lt;/a&gt;&amp;nbsp; shared this expression counts how many Store-Item combinations have zero sales and are ranked in the top 100 based on total sales across all data, ignoring current selections and aggregate on Store and item&lt;/P&gt;
&lt;P&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;Sum(Sales) = 0&lt;BR /&gt;AND Rank(TOTAL Sum({1} Sales)) &amp;lt;= 100,&lt;BR /&gt;1,&lt;BR /&gt;0&lt;BR /&gt;),&lt;BR /&gt;Store, Item&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 08:53:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533361#M108205</guid>
      <dc:creator>Amit_Prajapati</dc:creator>
      <dc:date>2025-10-14T08:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: aggr and rank</title>
      <link>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533362#M108206</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/49432"&gt;@Chanty4u&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I would like to clarify that total network sales must be calculated for each item.&lt;BR /&gt;I must consider the item if it has sales = 0 compared to the store and be among the top 100 items considering sales across the entire network, i.e., once the item has been fixed and considering all stores.&lt;/P&gt;&lt;P&gt;So unfortunately, the expression you suggest is incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;stefano&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 09:11:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533362#M108206</guid>
      <dc:creator>stefano_marson</dc:creator>
      <dc:date>2025-10-14T09:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: aggr and rank</title>
      <link>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533363#M108207</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/334743"&gt;@Amit_Prajapati&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I would like to clarify that total network sales must be calculated for each item.&lt;BR /&gt;I must consider the item if it has sales = 0 compared to the store and be among the top 100 items considering sales across the entire network, i.e., once the item has been fixed and considering all stores.&lt;/P&gt;&lt;P&gt;So unfortunately, the expression proposed by &lt;A href="https://community.qlik.com/t5/user/viewprofilepage/user-id/49432" target="_blank"&gt;@Chanty4u&lt;/A&gt;&amp;nbsp;is incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;stefano&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 09:14:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533363#M108207</guid>
      <dc:creator>stefano_marson</dc:creator>
      <dc:date>2025-10-14T09:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: aggr and rank</title>
      <link>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533366#M108208</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/44183"&gt;@stefano_marson&lt;/a&gt;&amp;nbsp;,If possible, please share sample data along with the expected output. That would help in reviewing and validating the issue more effectively.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 09:55:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533366#M108208</guid>
      <dc:creator>Amit_Prajapati</dc:creator>
      <dc:date>2025-10-14T09:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: aggr and rank</title>
      <link>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533394#M108212</link>
      <description>&lt;P&gt;I could imagine applying something like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-(sum(Sales)=0) * aggr(nodistinct -(&lt;/SPAN&gt;&lt;SPAN&gt;rank(sum(TOTAL Sales), 4)&amp;lt;=100), Item)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;to simplify the approach and making the parts separately testable.&lt;/P&gt;&lt;P&gt;Further important will be that the first condition is mostly only workable if there are ZERO/NULL records for each Item which is usually rather seldom by fact-data. More common is that these records are missing. In this case you may try to extend it to something like: rangesum(sum(Sales), sum({1} 0)) but within the majority of scenarios it won't work and you will need to populate the missing data.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 14:55:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/aggr-and-rank/m-p/2533394#M108212</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-10-14T14:55:58Z</dc:date>
    </item>
  </channel>
</rss>

