<?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: Pivot table with grouping in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776647#M275324</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My problem is that the users should have the possibility to change the value for date2 with a calender object in the GUI. Then the pivot table should be re-calculated.&lt;/P&gt;&lt;P&gt;That is why, I think I could not calculate the difference in the load script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Nov 2014 09:39:26 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-11-19T09:39:26Z</dc:date>
    <item>
      <title>Pivot table with grouping</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776644#M275321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope you can help me on this issue:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my raw data contains 3 data sets:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;id&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;date1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;date2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;class&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;amount&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.01.2012&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;05.01.2012&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;a&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;02.01.2012&lt;/TD&gt;&lt;TD&gt;05.01.2012&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;03.01.2012&lt;/TD&gt;&lt;TD&gt;05.01.2012&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;set 1 is overdue 4 days (05.01.2012 - 01.01.2012 = 4 days)&lt;/LI&gt;&lt;LI&gt;set 2 is overdue 3 days (05.01.2012 - 01.01.2012 = 3 days)&lt;/LI&gt;&lt;LI&gt;set 3 is overdue 2 days (05.01.2012 - 01.01.2012 = 2 days).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I would like to present the sum of amounts in a pivot table grouped by class like this:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;class&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;total&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;overdue &amp;lt;= 2 days&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;overdue &amp;gt;= 4 days&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;a&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My pivot table in QlikView contains the dimension "class" and the following 3 expressions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;sum(amount)&lt;/STRONG&gt; labeled &lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;&lt;STRONG&gt;"total"&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;if (date2-date1 &amp;lt;= 2, sum(amount), 0)&lt;/STRONG&gt; labeled &lt;STRONG style=": ; color: #0000ff;"&gt;&lt;EM&gt;"overdue &amp;lt;= 2 days"&lt;/EM&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;if (date2-date1 &amp;gt;= 4, sum(amount), 0)&lt;/STRONG&gt; labeled &lt;STRONG&gt;&lt;EM style="color: #0000ff;"&gt;"overdue &amp;gt;= 4 days"&lt;/EM&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;With these expressions my pivot table does not look like expected but it looks like this:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;class&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;total&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;overdue &amp;lt;= 2 days&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;overdue &amp;gt;= 4 days&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;a&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know what I did wrong? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. See also my QVW attached.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM style="color: #0000ff;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM style="color: #0000ff;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 09:20:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776644#M275321</guid>
      <dc:creator />
      <dc:date>2014-11-19T09:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot table with grouping</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776645#M275322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see attched file &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use &lt;STRONG&gt;date2-date1 as difference&lt;/STRONG&gt; in script&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 09:32:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776645#M275322</guid>
      <dc:creator>SunilChauhan</dc:creator>
      <dc:date>2014-11-19T09:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot table with grouping</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776646#M275323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your pivot table is 100% correct.&lt;/P&gt;&lt;P&gt;When you write&lt;STRONG&gt; if(date2-date2&amp;lt;=2,sum(Amount),0)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here the date2-date1 is grouped on the dimension you are using that is Class&lt;/P&gt;&lt;P&gt;For Class b the &lt;STRONG&gt;Date2-date1&lt;/STRONG&gt; has two values as 2 and 3 , now for the whole class it is added as &lt;STRONG&gt;2+3=5&lt;/STRONG&gt; which is not &lt;STRONG&gt;&amp;lt;=2 hence it represents 0&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 09:32:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776646#M275323</guid>
      <dc:creator>sujeetsingh</dc:creator>
      <dc:date>2014-11-19T09:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot table with grouping</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776647#M275324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My problem is that the users should have the possibility to change the value for date2 with a calender object in the GUI. Then the pivot table should be re-calculated.&lt;/P&gt;&lt;P&gt;That is why, I think I could not calculate the difference in the load script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 09:39:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776647#M275324</guid>
      <dc:creator />
      <dc:date>2014-11-19T09:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot table with grouping</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776648#M275325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I see. Is it possible to re-write my expression, that only the amount of data set 3 is taken into account for class b (not the whole sum)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 09:47:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776648#M275325</guid>
      <dc:creator />
      <dc:date>2014-11-19T09:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot table with grouping</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776649#M275326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps there is a way to re-calculate the difference when the user changes date2 in the calender object (e.g. with a trigger or something else)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 09:51:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776649#M275326</guid>
      <dc:creator />
      <dc:date>2014-11-19T09:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Pivot table with grouping</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776650#M275327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please find attached my test.qvw using a calendar object for date2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 16:26:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-table-with-grouping/m-p/776650#M275327</guid>
      <dc:creator />
      <dc:date>2014-11-19T16:26:48Z</dc:date>
    </item>
  </channel>
</rss>

