<?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: Rolling 12 month backwards in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Rolling-12-month-backwards/m-p/771608#M471958</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think you should create a mastercalendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Mastercalendar in script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vZeitraum12Monate = '=$' &amp;amp; '(vAktuellerMonat)' &amp;amp; '-11';&lt;BR /&gt;LET vZeitraum6Monate = '=$' &amp;amp; '(vAktuellerMonat)' &amp;amp; '-5';&lt;BR /&gt;LET vZeitraum3Monate = '=$' &amp;amp; '(vAktuellerMonat)' &amp;amp; '-2';&lt;/P&gt;&lt;P&gt;LET vDateMin = Num(MakeDate(2008,1,1));&lt;BR /&gt;LET vDateMax = Floor(YearEnd(AddMonths(Today(), 1)));&lt;BR /&gt;LET vDateToday = Num(Today());&lt;/P&gt;&lt;P&gt;TempCalendar:&amp;nbsp; &lt;BR /&gt;LOAD &lt;BR /&gt;$(vDateMin) + RowNo() - 1 AS DateNumber,&amp;nbsp; &lt;BR /&gt;Date($(vDateMin) + RowNo() - 1) AS TempDate&lt;BR /&gt;AUTOGENERATE 1&amp;nbsp; &lt;BR /&gt;WHILE $(vDateMin)+IterNo()-1&amp;lt;= $(vDateMax);&lt;/P&gt;&lt;P&gt;MasterCalendar:&amp;nbsp; &lt;BR /&gt;LOAD &lt;BR /&gt;(year(TempDate)*12 + Month(TempDate)) - (year($(vDateMin))*12 + Month($(vDateMin))) as MonthNumber,&lt;BR /&gt;(year(TempDate)*12 + Month(TempDate)) - (year($(vDateToday))*12 + Month($(vDateToday))) as MonthDiff,&lt;BR /&gt;'AK_' &amp;amp; Date(TempDate,'YYYYMMDD') AS Referal_Date,&amp;nbsp; &lt;BR /&gt;Day(TempDate) AS CalendarDay,&amp;nbsp; &lt;BR /&gt;WeekDay(TempDate) AS CalendarWeekDay,&amp;nbsp; &lt;BR /&gt;Week(TempDate) AS CalendarWeek,&amp;nbsp; &lt;BR /&gt;Month(TempDate) AS CalendarMonth,&amp;nbsp; &lt;BR /&gt;Num(Month(TempDate),00) AS MonthAsNumber,&lt;BR /&gt;Year(TempDate) AS CalendarYear,&amp;nbsp; &lt;BR /&gt;'Q' &amp;amp; Ceil(Month(TempDate)/3) AS CalendarQuarter,&lt;BR /&gt;WeekDay(TempDate) &amp;amp; '-' &amp;amp; Year(TempDate) AS CalendarWeekAndYear,&amp;nbsp; &lt;BR /&gt;Date(TempDate,'YYYY-MM') AS CalendarMonthAndYear,&lt;BR /&gt;Num(Date(TempDate,'YYYYMMDD')) AS CalendarYearMonthDay,&lt;BR /&gt;Year(TempDate)&amp;amp;Num(Month(TempDate),00) AS CalendarYearMonth,&lt;BR /&gt;Num(Month(TempDate),00)&amp;amp;'/'&amp;amp;Date(TempDate,'YY') AS DateDimension,&lt;BR /&gt;Year2Date(TempDate, 0, 1, $(vToday))*-1 AS CalendarCurYTDFlag,&lt;BR /&gt;Year2Date(TempDate,-1, 1, $(vToday))*-1 AS CalendarLastYTDFlag&lt;BR /&gt;RESIDENT TempCalendar ORDER BY TempDate ASC;&lt;/P&gt;&lt;P&gt;DROP TABLE TempCalendar;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;connect Referal_Date from Mastercalendar with your table, something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 'AK_' &amp;amp; Date(Datum,'YYYYMMDD') AS Referal_Date&amp;nbsp;&amp;nbsp;&amp;nbsp; or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 'AK_' &amp;amp; Date(Date#(Datum, 'YYYY/MM'),'YYYYMMDD') AS Referal_Date,&lt;BR /&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2. create diagramm with following dimension:&amp;nbsp; &lt;BR /&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; =if(MonthDiff&amp;gt;=$(vZeitraum12Monate) and MonthDiff&amp;lt;=$(vAktuellerMonat),MonthAsNumber)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;3. chart formula (invisible style):&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; =avg({1}MonthDiff/MonthDiff) &lt;BR /&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;4. Sort: Formula:&amp;nbsp;&amp;nbsp;&amp;nbsp; = MonthNumber&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. Your chartexpression: e.g. sum(sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. create a Slider with vAktuellerMonat as Variable, Minvalue= -11, Maxvalue= 0 Interval: 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thats it!&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Feb 2015 16:43:02 GMT</pubDate>
    <dc:creator>Frank_Hartmann</dc:creator>
    <dc:date>2015-02-09T16:43:02Z</dc:date>
    <item>
      <title>Rolling 12 month backwards</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-12-month-backwards/m-p/771606#M471956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my expression, i am adding this code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count({$&amp;lt;[Cause Code]={'Access Issue'},InciMonth = {"&amp;gt;=$(=Month(MonthStart(Max(Approved))-365))&amp;lt;=$(=Month(MonthEnd(Max(Approved))-1))"},InciYear=,InciMonth=&amp;gt;}[Task])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i am counting the Task with the Cause Code ='Access Issue'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Approved is the Date column . InciYear &amp;amp; InciMonth is the Year &amp;amp; Month Respectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The values i am getting correctly, but the x-axis is not changing based on my month selection. Can you please help me out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sasikumar.R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 16:09:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-12-month-backwards/m-p/771606#M471956</guid>
      <dc:creator />
      <dc:date>2015-02-09T16:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 12 month backwards</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-12-month-backwards/m-p/771607#M471957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;a sample app would help, but I guess you need to create a calculated dimension with similar set analysis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 16:27:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-12-month-backwards/m-p/771607#M471957</guid>
      <dc:creator>giakoum</dc:creator>
      <dc:date>2015-02-09T16:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 12 month backwards</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-12-month-backwards/m-p/771608#M471958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think you should create a mastercalendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Mastercalendar in script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vZeitraum12Monate = '=$' &amp;amp; '(vAktuellerMonat)' &amp;amp; '-11';&lt;BR /&gt;LET vZeitraum6Monate = '=$' &amp;amp; '(vAktuellerMonat)' &amp;amp; '-5';&lt;BR /&gt;LET vZeitraum3Monate = '=$' &amp;amp; '(vAktuellerMonat)' &amp;amp; '-2';&lt;/P&gt;&lt;P&gt;LET vDateMin = Num(MakeDate(2008,1,1));&lt;BR /&gt;LET vDateMax = Floor(YearEnd(AddMonths(Today(), 1)));&lt;BR /&gt;LET vDateToday = Num(Today());&lt;/P&gt;&lt;P&gt;TempCalendar:&amp;nbsp; &lt;BR /&gt;LOAD &lt;BR /&gt;$(vDateMin) + RowNo() - 1 AS DateNumber,&amp;nbsp; &lt;BR /&gt;Date($(vDateMin) + RowNo() - 1) AS TempDate&lt;BR /&gt;AUTOGENERATE 1&amp;nbsp; &lt;BR /&gt;WHILE $(vDateMin)+IterNo()-1&amp;lt;= $(vDateMax);&lt;/P&gt;&lt;P&gt;MasterCalendar:&amp;nbsp; &lt;BR /&gt;LOAD &lt;BR /&gt;(year(TempDate)*12 + Month(TempDate)) - (year($(vDateMin))*12 + Month($(vDateMin))) as MonthNumber,&lt;BR /&gt;(year(TempDate)*12 + Month(TempDate)) - (year($(vDateToday))*12 + Month($(vDateToday))) as MonthDiff,&lt;BR /&gt;'AK_' &amp;amp; Date(TempDate,'YYYYMMDD') AS Referal_Date,&amp;nbsp; &lt;BR /&gt;Day(TempDate) AS CalendarDay,&amp;nbsp; &lt;BR /&gt;WeekDay(TempDate) AS CalendarWeekDay,&amp;nbsp; &lt;BR /&gt;Week(TempDate) AS CalendarWeek,&amp;nbsp; &lt;BR /&gt;Month(TempDate) AS CalendarMonth,&amp;nbsp; &lt;BR /&gt;Num(Month(TempDate),00) AS MonthAsNumber,&lt;BR /&gt;Year(TempDate) AS CalendarYear,&amp;nbsp; &lt;BR /&gt;'Q' &amp;amp; Ceil(Month(TempDate)/3) AS CalendarQuarter,&lt;BR /&gt;WeekDay(TempDate) &amp;amp; '-' &amp;amp; Year(TempDate) AS CalendarWeekAndYear,&amp;nbsp; &lt;BR /&gt;Date(TempDate,'YYYY-MM') AS CalendarMonthAndYear,&lt;BR /&gt;Num(Date(TempDate,'YYYYMMDD')) AS CalendarYearMonthDay,&lt;BR /&gt;Year(TempDate)&amp;amp;Num(Month(TempDate),00) AS CalendarYearMonth,&lt;BR /&gt;Num(Month(TempDate),00)&amp;amp;'/'&amp;amp;Date(TempDate,'YY') AS DateDimension,&lt;BR /&gt;Year2Date(TempDate, 0, 1, $(vToday))*-1 AS CalendarCurYTDFlag,&lt;BR /&gt;Year2Date(TempDate,-1, 1, $(vToday))*-1 AS CalendarLastYTDFlag&lt;BR /&gt;RESIDENT TempCalendar ORDER BY TempDate ASC;&lt;/P&gt;&lt;P&gt;DROP TABLE TempCalendar;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;connect Referal_Date from Mastercalendar with your table, something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 'AK_' &amp;amp; Date(Datum,'YYYYMMDD') AS Referal_Date&amp;nbsp;&amp;nbsp;&amp;nbsp; or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 'AK_' &amp;amp; Date(Date#(Datum, 'YYYY/MM'),'YYYYMMDD') AS Referal_Date,&lt;BR /&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2. create diagramm with following dimension:&amp;nbsp; &lt;BR /&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; =if(MonthDiff&amp;gt;=$(vZeitraum12Monate) and MonthDiff&amp;lt;=$(vAktuellerMonat),MonthAsNumber)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;3. chart formula (invisible style):&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; =avg({1}MonthDiff/MonthDiff) &lt;BR /&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;4. Sort: Formula:&amp;nbsp;&amp;nbsp;&amp;nbsp; = MonthNumber&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. Your chartexpression: e.g. sum(sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. create a Slider with vAktuellerMonat as Variable, Minvalue= -11, Maxvalue= 0 Interval: 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thats it!&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 16:43:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-12-month-backwards/m-p/771608#M471958</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2015-02-09T16:43:02Z</dc:date>
    </item>
  </channel>
</rss>

