<?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 Using  ValueList in Pivot for current and previous periods not working as expected in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-ValueList-in-Pivot-for-current-and-previous-periods-not/m-p/2028213#M84724</link>
    <description>&lt;P&gt;Hi People,&lt;/P&gt;
&lt;P&gt;I use Valuelist to add a period column to a pivot table: P1 and P2.&lt;/P&gt;
&lt;P&gt;P1 for current period, P2 for previous period - calculated based on the user selection.&lt;/P&gt;
&lt;P&gt;The pivot shows # of entries by category code, for each supplier.&lt;/P&gt;
&lt;P&gt;When no year is selected - the pivot works fine.&lt;/P&gt;
&lt;P&gt;It shows a supplier previous period data even if he doesn't have data in the current period.&lt;/P&gt;
&lt;P&gt;for example, supplier no. 1:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PIVOT BEFORE FIX - NO SELECTION.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98507iF1164287952BF51A/image-size/large?v=v2&amp;amp;px=999" role="button" title="PIVOT BEFORE FIX - NO SELECTION.png" alt="PIVOT BEFORE FIX - NO SELECTION.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;But if a year is selected, this supplier is not displayed any more in the pivot.&lt;/P&gt;
&lt;P&gt;But he is displayed in a table below the pivot, where no period&amp;nbsp; column is used:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PIVOT BEFORE FIX - with SELECTION.png" style="width: 672px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98509i63A497F4E0DC5B1D/image-dimensions/672x260?v=v2" width="672" height="260" role="button" title="PIVOT BEFORE FIX - with SELECTION.png" alt="PIVOT BEFORE FIX - with SELECTION.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;For each supplier, I added the missing&amp;nbsp; periods with 0 values for entries, and it resolved the issue.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PIVOT AFTER FIX.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98510i81F8351AF1BF9233/image-size/large?v=v2&amp;amp;px=999" role="button" title="PIVOT AFTER FIX.png" alt="PIVOT AFTER FIX.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But I don't understand why.&lt;/P&gt;
&lt;P&gt;My questions are:&lt;/P&gt;
&lt;P&gt;Why this works and&amp;nbsp;Is there a better solution?&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;SPAN&gt;My expressions format is:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;//Current Period&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;SPAN&gt;Sum({&amp;lt;Year=, Quarter=, Month=, Week=, [Order Date]=, DateKey={"&amp;gt;=$(=Num(YearStart(Max(DateKey)))) &amp;lt;=$(=Max(DateKey))"}&amp;gt;}Entries)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;//Previous Period&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;SPAN&gt;Sum({&amp;lt;Year=, Quarter=, Month=, Week=, [Order Date]=, DateKey={"&amp;gt;=$(=Num(YearStart(AddYears(Max(DateKey),-1)))) &amp;lt;=$(=Num(AddYears(Max(DateKey),-1)))"}&amp;gt;}Entries)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2023 10:44:34 GMT</pubDate>
    <dc:creator>dana</dc:creator>
    <dc:date>2023-01-20T10:44:34Z</dc:date>
    <item>
      <title>Using  ValueList in Pivot for current and previous periods not working as expected</title>
      <link>https://community.qlik.com/t5/App-Development/Using-ValueList-in-Pivot-for-current-and-previous-periods-not/m-p/2028213#M84724</link>
      <description>&lt;P&gt;Hi People,&lt;/P&gt;
&lt;P&gt;I use Valuelist to add a period column to a pivot table: P1 and P2.&lt;/P&gt;
&lt;P&gt;P1 for current period, P2 for previous period - calculated based on the user selection.&lt;/P&gt;
&lt;P&gt;The pivot shows # of entries by category code, for each supplier.&lt;/P&gt;
&lt;P&gt;When no year is selected - the pivot works fine.&lt;/P&gt;
&lt;P&gt;It shows a supplier previous period data even if he doesn't have data in the current period.&lt;/P&gt;
&lt;P&gt;for example, supplier no. 1:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PIVOT BEFORE FIX - NO SELECTION.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98507iF1164287952BF51A/image-size/large?v=v2&amp;amp;px=999" role="button" title="PIVOT BEFORE FIX - NO SELECTION.png" alt="PIVOT BEFORE FIX - NO SELECTION.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;But if a year is selected, this supplier is not displayed any more in the pivot.&lt;/P&gt;
&lt;P&gt;But he is displayed in a table below the pivot, where no period&amp;nbsp; column is used:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PIVOT BEFORE FIX - with SELECTION.png" style="width: 672px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98509i63A497F4E0DC5B1D/image-dimensions/672x260?v=v2" width="672" height="260" role="button" title="PIVOT BEFORE FIX - with SELECTION.png" alt="PIVOT BEFORE FIX - with SELECTION.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;For each supplier, I added the missing&amp;nbsp; periods with 0 values for entries, and it resolved the issue.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PIVOT AFTER FIX.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98510i81F8351AF1BF9233/image-size/large?v=v2&amp;amp;px=999" role="button" title="PIVOT AFTER FIX.png" alt="PIVOT AFTER FIX.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But I don't understand why.&lt;/P&gt;
&lt;P&gt;My questions are:&lt;/P&gt;
&lt;P&gt;Why this works and&amp;nbsp;Is there a better solution?&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;SPAN&gt;My expressions format is:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;//Current Period&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;SPAN&gt;Sum({&amp;lt;Year=, Quarter=, Month=, Week=, [Order Date]=, DateKey={"&amp;gt;=$(=Num(YearStart(Max(DateKey)))) &amp;lt;=$(=Max(DateKey))"}&amp;gt;}Entries)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;//Previous Period&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;SPAN&gt;Sum({&amp;lt;Year=, Quarter=, Month=, Week=, [Order Date]=, DateKey={"&amp;gt;=$(=Num(YearStart(AddYears(Max(DateKey),-1)))) &amp;lt;=$(=Num(AddYears(Max(DateKey),-1)))"}&amp;gt;}Entries)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 11.25pt 0cm;"&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 10:44:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-ValueList-in-Pivot-for-current-and-previous-periods-not/m-p/2028213#M84724</guid>
      <dc:creator>dana</dc:creator>
      <dc:date>2023-01-20T10:44:34Z</dc:date>
    </item>
  </channel>
</rss>

