<?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: Sort dimension by expression in a pivot table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1634213#M907463</link>
    <description>&lt;P&gt;I had a same scenario where i had 3 dimensions in my pivot table and 8 measures. All dimensions where Row Dimensions. my sorted was supposed be on the 3rd inside dimension, so i had to Sort the 1st dimension by Y-Value, the second dimension by Text, and the last dimension by Value, thats how i resolved my issue.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Oct 2019 11:32:58 GMT</pubDate>
    <dc:creator>ekademeteme</dc:creator>
    <dc:date>2019-10-11T11:32:58Z</dc:date>
    <item>
      <title>Sort dimension by expression in a pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148981#M907457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after spending almost an entire day I realize that I'm stuck and can't solve this problem on my own by googling etc. I'm fairly new to Qlikview and for confidentiality reasons I can't share my file. I'll try to explain as much as possible to give a clear picture of what I want to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;a pivot table with 3 dimensions and 6 expressions. The table is meant to help visualize what we sell, how much and to whom.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;From left to right:&lt;/P&gt;&lt;P&gt;Dimensions: Customer, Product family, Material Name&lt;/P&gt;&lt;P&gt;Expressions: Quantity YTD, Quantity last year, Quantity two years ago, Total Price YTD, Total Price last year and Total price two years ago.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to sort the information in the dimensions by the following order:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Biggest customers first, Product family in &lt;/SPAN&gt;alphabetical order &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;and Material name according to last years top grossing material on top.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The formula that's used in the expression "Total Price last year" is:&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;[Fiscal year]={"$(=(max([Fiscal year])-1))"}&amp;gt;}[Net Invoice Price])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The standard sort functions obviously doesn't work for dimension 1 and 3. &lt;SPAN style="font-size: 13.3333px;"&gt;As a beginner, I've tried playing around with the AGGR() function. I've successfully managed to sort the first dimension by the following expression. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=aggr(sum({$&amp;lt;[Fiscal year]={"$(=(max([Fiscal year])-1))"}&amp;gt;}[Net Invoice Price]),[Customer Name])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second dimension could be solved by the standard sort functions,&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; but the last one I can't seem to solve. I assumed it would be like the first dimension, but it wasn't. &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;It doesn't work if I try and sort the Dimension with Material Name by the following expression:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=aggr(sum({$&amp;lt;[Fiscal year]={"$(=(max([Fiscal year])-1))"}&amp;gt;}[Net Invoice Price]),[Customer Name],[Product Family],[Material])&lt;/P&gt;&lt;P&gt;It sorts somehow but I can't figure out the logic behind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I make a new dimension from the exact same expression and put it before Material Name I can easily sort it by the standard functions. However as it is a pivot table I can't hide this column and it looks really bad to have it in there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, could anybody advice me how to adapt the sorting formula in the dimension with Material Name?&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148981#M907457</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sort dimension by expression in a pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148982#M907458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this on Pivot Table sorting by expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-7220"&gt;Perfectly Sorting Pivot Table (by A-Z. y-Value set for each dim-level)&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 18:13:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148982#M907458</guid>
      <dc:creator>ziadm</dc:creator>
      <dc:date>2016-06-19T18:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sort dimension by expression in a pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148983#M907459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can u upload a sample qvw?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 18:22:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148983#M907459</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2016-06-19T18:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sort dimension by expression in a pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148984#M907460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi and thanks for the link. Looks interesting but not really understandable to me yet. I'll look through it again later and see if I can make some sense out of it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 18:25:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148984#M907460</guid>
      <dc:creator />
      <dc:date>2016-06-19T18:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sort dimension by expression in a pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148985#M907461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry I can't share the file and I'm not competent enough to set up a demo environment for test purposes. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 18:30:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148985#M907461</guid>
      <dc:creator />
      <dc:date>2016-06-19T18:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sort dimension by expression in a pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148986#M907462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hampus,&lt;/P&gt;&lt;P&gt;In the sort tab of the pivot table set the orders like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1st dimension Customer. Sort by an expression such as Sum(Sales) or whatever expression you would use to determine your "biggest customer". Set sort order to descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2nd dimension &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Product family. Sort by Text A -&amp;gt; Z.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3rd dimension &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Material Name.&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;Sort by an expression such as Sum({$&amp;lt;Year = {$(=-1+max(Year))}&amp;gt;} Sales).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;You will need to replace Year and Sales with whatever the relevant terms are in your data model. &lt;SPAN style="font-size: 13.3333px;"&gt;Set sort order to descending.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 21:04:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1148986#M907462</guid>
      <dc:creator>effinty2112</dc:creator>
      <dc:date>2016-06-19T21:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sort dimension by expression in a pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1634213#M907463</link>
      <description>&lt;P&gt;I had a same scenario where i had 3 dimensions in my pivot table and 8 measures. All dimensions where Row Dimensions. my sorted was supposed be on the 3rd inside dimension, so i had to Sort the 1st dimension by Y-Value, the second dimension by Text, and the last dimension by Value, thats how i resolved my issue.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 11:32:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-dimension-by-expression-in-a-pivot-table/m-p/1634213#M907463</guid>
      <dc:creator>ekademeteme</dc:creator>
      <dc:date>2019-10-11T11:32:58Z</dc:date>
    </item>
  </channel>
</rss>

