<?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 Sort a Pivot Table with blank fields as 0 in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208955#M588423</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Nigel. I played with your idea. I had to remove the Null values in the Sales Last Year field, which worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sales This Year = Sum(SALES)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;&lt;/I&gt;&lt;I&gt;&lt;/I&gt;&lt;BR /&gt;Sales Last Year = If (ISNULL([Sales This Year]), NULL(),IF([Sales This Year]=0,NULL(), Sum({&amp;lt;Year = &lt;B&gt;{&lt;EM&gt;"$(=GetFieldSelections("&lt;/EM&gt;&lt;/B&gt;Year")-1)"} &amp;gt;} SALES)))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This is not ideal because it excludes Customers with sales last year but no sales this year. I can live with this because I only need the top customers.&lt;/P&gt;&lt;P&gt;I think the issue was the order in which the expressions were being calculated/populated - [SalesThis Year] first and [Sales Last Year] second, so whatever I seemed to specify in [Sales This Year] to exclude Null values had no effect, because they appeared when [Sales Last Year] was calculated.&lt;/P&gt;&lt;P&gt;Not the cleanest of solutions, but it works for the moment!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Apr 2010 12:29:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-04-12T12:29:49Z</dc:date>
    <item>
      <title>Sort a Pivot Table with blank fields as 0</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208953#M588421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a pivot table with 4 dimensions (&lt;EM&gt;customer, etc, etc&lt;/EM&gt;) and two expressions, &lt;EM&gt;sales this year&lt;/EM&gt; and &lt;EM&gt;sales last year.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sales this year = Sum(SALES)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sales last year takes the user date selections and collects the data from 1 year ago&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;&lt;PRE&gt;&lt;EM&gt;&lt;/EM&gt;&lt;EM&gt;Sum&lt;/EM&gt;({&amp;lt;Year = {&lt;B&gt;&lt;I&gt;"$(=GetFieldSelections("&lt;/I&gt;&lt;/B&gt;Year")-1)"} &amp;gt;} SALES) &lt;EM&gt;&lt;/EM&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;There are some customers that do not have &lt;EM&gt;sales this year,&lt;/EM&gt; but do have &lt;EM&gt;sales last year.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;My problem is when I try to sort the pivot table by &lt;EM&gt;sales this year (Sum(SALES)&lt;/EM&gt;, the customers that have no data in &lt;EM&gt;sales this year&lt;/EM&gt; are automatically placed at the top of the list. They display a 0 value, but I think because the actual value in the cell is blank, Qlikview is not sorting them as 0 values.&lt;/P&gt;&lt;P&gt;Does anyone know how I can fix this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Apr 2010 13:21:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208953#M588421</guid>
      <dc:creator />
      <dc:date>2010-04-09T13:21:50Z</dc:date>
    </item>
    <item>
      <title>Sort a Pivot Table with blank fields as 0</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208954#M588422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rick&lt;/P&gt;&lt;P&gt;You could try amending your expression for sales this year to deal with null values and convert to zero, something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;=IF(ISNULL(Sum(Sales)),0,Sum(Sales))&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Hope it helps,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Apr 2010 14:55:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208954#M588422</guid>
      <dc:creator />
      <dc:date>2010-04-09T14:55:43Z</dc:date>
    </item>
    <item>
      <title>Sort a Pivot Table with blank fields as 0</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208955#M588423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Nigel. I played with your idea. I had to remove the Null values in the Sales Last Year field, which worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sales This Year = Sum(SALES)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;&lt;/I&gt;&lt;I&gt;&lt;/I&gt;&lt;BR /&gt;Sales Last Year = If (ISNULL([Sales This Year]), NULL(),IF([Sales This Year]=0,NULL(), Sum({&amp;lt;Year = &lt;B&gt;{&lt;EM&gt;"$(=GetFieldSelections("&lt;/EM&gt;&lt;/B&gt;Year")-1)"} &amp;gt;} SALES)))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This is not ideal because it excludes Customers with sales last year but no sales this year. I can live with this because I only need the top customers.&lt;/P&gt;&lt;P&gt;I think the issue was the order in which the expressions were being calculated/populated - [SalesThis Year] first and [Sales Last Year] second, so whatever I seemed to specify in [Sales This Year] to exclude Null values had no effect, because they appeared when [Sales Last Year] was calculated.&lt;/P&gt;&lt;P&gt;Not the cleanest of solutions, but it works for the moment!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 12:29:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208955#M588423</guid>
      <dc:creator />
      <dc:date>2010-04-12T12:29:49Z</dc:date>
    </item>
    <item>
      <title>Sort a Pivot Table with blank fields as 0</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208956#M588424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should probably use indirect set analysis (use Help for syntax or one of the Set Analysis qvws)&lt;/P&gt;&lt;P&gt;Sample questions:&lt;/P&gt;&lt;P&gt;- select customers with sales from last year where they have sales this year&lt;/P&gt;&lt;P&gt;- select customers with sales from last year where they have no sales this year&lt;/P&gt;&lt;P&gt;- select customers with sales from this year where they had sales this year&lt;/P&gt;&lt;P&gt;- select customers with sales from this year where they had no sales this year&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 13:15:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208956#M588424</guid>
      <dc:creator />
      <dc:date>2010-04-12T13:15:51Z</dc:date>
    </item>
    <item>
      <title>Sort a Pivot Table with blank fields as 0</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208957#M588425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mark.&lt;/P&gt;&lt;P&gt;I went with the original solution as it gave the correct data. Your solution looks good, but I am working on other things now, so I will get back to it when I clean up this part of the project.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Apr 2010 10:46:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208957#M588425</guid>
      <dc:creator />
      <dc:date>2010-04-13T10:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sort a Pivot Table with blank fields as 0</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208958#M588426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For ones that are looking for the solution:&lt;/P&gt;&lt;P&gt;I had a similar problem. The solution is to sort by expression and in this expression use rank function, for ex.&lt;/P&gt;&lt;P&gt;rank(count(id)) and sort it ascending. This will solve the problem &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;. It worked for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2012 12:07:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-a-Pivot-Table-with-blank-fields-as-0/m-p/208958#M588426</guid>
      <dc:creator />
      <dc:date>2012-07-26T12:07:33Z</dc:date>
    </item>
  </channel>
</rss>

