title: Qlikview Automate past 12 months selection
body: <p>I have a combo chart which shows the average days it took for a person to pay their bill.</p>
  
  <p>The Dimension of the Chart is <code>= [Pay Month Year last 12 months]</code></p>
  
  <p>There are no Dimension limits</p>
  
  <p>There is 1 expression which is called <code>Average</code> and its definition is: </p>
  
  <pre><code>avg({&lt; InvoicefromSqlType = {'Invoices'},[Is Invoice Paid] = {'Y'},[Is Positive Amount] = {'Y'},[Is Paid last 12 months] = {'Y'},DueGroups=,[Pay Month Year last 12 months]=&gt;}[Days to Pay])`
  </code></pre>
  
  <p>Its is sorted by expression, which is <code>[Pay Month Year last 12 months]</code></p>
  
  <p>Now the above fields are built up like this:</p>
  
  <p><strong>[Pay Month Year last 12 months]</strong></p>
  
  <pre><code>If([Pay Date] &gt;= '$(vPeriodS12)',[Pay Month year]) as [Pay Month Year last 12 months],
  </code></pre>
  
  <blockquote>
    <p>PayLoadOrder:</p>
  </blockquote>
  
  <pre><code>Load * Inline [Pay Month Year last 12 months
  May-2014
  Jun-2014
  Jul-2014
  Aug-2014
  Sep-2014
  Oct-2014
  Nov-2014
  Dec-2014
  Jan-2015
  Feb-2015
  Mar-2015
  Apr-2015
  May-2015
  ];
  </code></pre>
  
  <p>Now what is happening is every month when it reaches the end, the next month is needing to be manually added and the first month removed (e.g. in the above I would delete the line May-2014 and at the end add the line Jun-2015)</p>
  
  <p>Also if there are months defined which there is no data for yet i.e. you have Jun-2015 hard coded and the current month this May-2015 then Jun-2015 will show data from 2014 and the order of the months will get mixed up.</p>
  
  <p>What I want to do is completely remove the need to hard code the months above and have this done its self.</p>
  
  <p>If there are any more information you need let me know</p>