<?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: Add Rank column to table at specific level of detail in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Add-Rank-column-to-table-at-specific-level-of-detail/m-p/2525041#M106964</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;How about this ways?&lt;/P&gt;&lt;P&gt;*** Data Load Script&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hanna_choi_0-1753256660728.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182275i600F181A3F406696/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hanna_choi_0-1753256660728.png" alt="hanna_choi_0-1753256660728.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;***** Visualization&lt;/P&gt;&lt;P&gt;expression :&amp;nbsp;aggr(nodistinct Rank(Sum(Revenue)), Advertiser)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hanna_choi_1-1753256765211.png" style="width: 527px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182276iCF8DEE87F47BD68F/image-dimensions/527x203?v=v2" width="527" height="203" role="button" title="hanna_choi_1-1753256765211.png" alt="hanna_choi_1-1753256765211.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jul 2025 07:46:44 GMT</pubDate>
    <dc:creator>hanna_choi</dc:creator>
    <dc:date>2025-07-23T07:46:44Z</dc:date>
    <item>
      <title>Add Rank column to table at specific level of detail</title>
      <link>https://community.qlik.com/t5/App-Development/Add-Rank-column-to-table-at-specific-level-of-detail/m-p/2524997#M106959</link>
      <description>&lt;P&gt;I have a data source table with dimensions called Agency and Advertiser, and a measure called Revenue. I am trying to add a Rank column that will show the rank of the Revenue at the Advertiser level of aggregation only. I tried the below expression but it did not give me the result I need.&lt;/P&gt;
&lt;P&gt;RANK(TOTAL&lt;BR /&gt;AGGR(SUM([Revenue]), [Advertiser]),1)&lt;/P&gt;
&lt;P&gt;Here is a specific example in SQL with sample data that gives me the desired result for reference:&lt;/P&gt;
&lt;P&gt;WITH temp_sales_table AS (&lt;BR /&gt;SELECT * FROM VALUES&lt;BR /&gt;('Agency A', 'Advertiser 1', 120000.00),&lt;BR /&gt;('Agency A', 'Advertiser 2', 95000.00),&lt;BR /&gt;('Agency A', 'Advertiser 3', 87000.00),&lt;BR /&gt;('Agency B', 'Advertiser 1', 110000.00),&lt;BR /&gt;('Agency B', 'Advertiser 4', 76000.00),&lt;BR /&gt;('Agency B', 'Advertiser 5', 99000.00),&lt;BR /&gt;('Agency C', 'Advertiser 2', 88000.00),&lt;BR /&gt;('Agency C', 'Advertiser 6', 67000.00),&lt;BR /&gt;('Agency C', 'Advertiser 7', 72000.00),&lt;BR /&gt;('Agency C', 'Advertiser 1', 105000.00)&lt;BR /&gt;AS temp_table(Agency, Advertiser, Revenue)&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;aggTable AS (&lt;BR /&gt;SELECT Advertiser, SUM(Revenue) AS NetBookedRev&lt;BR /&gt;FROM temp_sales_table&lt;BR /&gt;GROUP BY Advertiser&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;rankTable AS (&lt;BR /&gt;SELECT&lt;BR /&gt;Advertiser,&lt;BR /&gt;NetBookedRev,&lt;BR /&gt;RANK() OVER (ORDER BY NetBookedRev DESC) AS Rank&lt;BR /&gt;FROM aggTable&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;advAggTable AS (&lt;BR /&gt;SELECT Agency, Advertiser, SUM(Revenue) AS Revenue&lt;BR /&gt;FROM temp_sales_table&lt;BR /&gt;GROUP BY Agency, Advertiser&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;SELECT advAggTable.Agency,&lt;BR /&gt;advAggTable.Advertiser,&lt;BR /&gt;advAggTable.Revenue,&lt;BR /&gt;rankTable.Rank&lt;BR /&gt;FROM advAggTable&lt;BR /&gt;LEFT JOIN rankTable&lt;BR /&gt;ON rankTable.Advertiser = advAggTable.Advertiser&lt;BR /&gt;ORDER BY Agency, Rank&lt;/P&gt;
&lt;P&gt;This results in the following table.&lt;/P&gt;
&lt;TABLE width="270"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;Revenue&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;Rank&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency A&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 1&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;120000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency A&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 2&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;95000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency A&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 3&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;87000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency B&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 1&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;110000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency B&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 5&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;99000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency B&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 4&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;76000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency C&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 1&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;105000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency C&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 2&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;88000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency C&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 7&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;72000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64.0417px"&gt;Agency C&lt;/TD&gt;
&lt;TD width="82.6979px"&gt;Advertiser 6&lt;/TD&gt;
&lt;TD width="74.7188px"&gt;67000&lt;/TD&gt;
&lt;TD width="48.0208px"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Here the Revenue is shown at the Agency, Advertiser level of detail, and the Rank is showing the Rank of Revenue at the Advertiser level of detail.&lt;/P&gt;
&lt;P&gt;Is there a way to do this in Qlik? I need to do on the front end using expressions. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 20:55:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Add-Rank-column-to-table-at-specific-level-of-detail/m-p/2524997#M106959</guid>
      <dc:creator>NattiNatey</dc:creator>
      <dc:date>2025-07-22T20:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Add Rank column to table at specific level of detail</title>
      <link>https://community.qlik.com/t5/App-Development/Add-Rank-column-to-table-at-specific-level-of-detail/m-p/2525041#M106964</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;How about this ways?&lt;/P&gt;&lt;P&gt;*** Data Load Script&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hanna_choi_0-1753256660728.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182275i600F181A3F406696/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hanna_choi_0-1753256660728.png" alt="hanna_choi_0-1753256660728.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;***** Visualization&lt;/P&gt;&lt;P&gt;expression :&amp;nbsp;aggr(nodistinct Rank(Sum(Revenue)), Advertiser)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hanna_choi_1-1753256765211.png" style="width: 527px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182276iCF8DEE87F47BD68F/image-dimensions/527x203?v=v2" width="527" height="203" role="button" title="hanna_choi_1-1753256765211.png" alt="hanna_choi_1-1753256765211.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 07:46:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Add-Rank-column-to-table-at-specific-level-of-detail/m-p/2525041#M106964</guid>
      <dc:creator>hanna_choi</dc:creator>
      <dc:date>2025-07-23T07:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Add Rank column to table at specific level of detail</title>
      <link>https://community.qlik.com/t5/App-Development/Add-Rank-column-to-table-at-specific-level-of-detail/m-p/2525124#M106979</link>
      <description>&lt;P&gt;This worked thanks so much&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/16864"&gt;@hanna_choi&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 19:09:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Add-Rank-column-to-table-at-specific-level-of-detail/m-p/2525124#M106979</guid>
      <dc:creator>NattiNatey</dc:creator>
      <dc:date>2025-07-23T19:09:08Z</dc:date>
    </item>
  </channel>
</rss>

