<?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 12 months trailing filter in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731933#M539920</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dashboard with lots of charts already built. Now I have been asked to add a filter that would be a 12 months trailing button. Basically it would filter on the most recent 12 months and then the previous 12 months from that, etc. For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;August 2013-July 2014 (expression 1) &lt;/P&gt;&lt;P&gt;August 2012-July 2013 (expression 2)&lt;/P&gt;&lt;P&gt;etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most of my charts have two or three expressions for current year and past year(s) petty basic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my question is:&lt;/P&gt;&lt;P&gt;1. What is the best way to incorporate this filter. Do I have to build an if statement of some kind so that if selected do..., otherwise do...&lt;/P&gt;&lt;P&gt;Or is it better to show and hide charts based on this selection?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All my expressions have max(year) in them so I don't see how I can use a last 12 months filter within those expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 Aug 2014 02:21:18 GMT</pubDate>
    <dc:creator>zagzebski</dc:creator>
    <dc:date>2014-08-23T02:21:18Z</dc:date>
    <item>
      <title>12 months trailing filter</title>
      <link>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731933#M539920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dashboard with lots of charts already built. Now I have been asked to add a filter that would be a 12 months trailing button. Basically it would filter on the most recent 12 months and then the previous 12 months from that, etc. For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;August 2013-July 2014 (expression 1) &lt;/P&gt;&lt;P&gt;August 2012-July 2013 (expression 2)&lt;/P&gt;&lt;P&gt;etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most of my charts have two or three expressions for current year and past year(s) petty basic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my question is:&lt;/P&gt;&lt;P&gt;1. What is the best way to incorporate this filter. Do I have to build an if statement of some kind so that if selected do..., otherwise do...&lt;/P&gt;&lt;P&gt;Or is it better to show and hide charts based on this selection?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All my expressions have max(year) in them so I don't see how I can use a last 12 months filter within those expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Aug 2014 02:21:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731933#M539920</guid>
      <dc:creator>zagzebski</dc:creator>
      <dc:date>2014-08-23T02:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: 12 months trailing filter</title>
      <link>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731934#M539921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For prior period filters one good way is to build a calendar table into your data model. The calendar table would have year, month, quarter and date.&amp;nbsp;&amp;nbsp; It would also have a few boolean flags, like Current Month, Current Quarter , Current Year , Prior Year etc... whose values are 1 or 0 depending on whether the date is in the current month etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use date functions and arithmetic functions to compute the flags. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could do the same flag approach in the table to create the&amp;nbsp; Last12Months , PriorYearLast12Months flags that you are after. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once that table with the flags are in place, the expression is a very straight forward SET ANALYSIS statement in the chart:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&amp;nbsp; {&amp;lt;$ 12MonthFlag={1}&amp;gt;}&amp;nbsp; &amp;lt;expression&amp;gt; )&lt;/P&gt;&lt;P&gt;sum(&amp;nbsp; {&amp;lt;$ PriorYear12MonthFlag={1}&amp;gt;}&amp;nbsp; &amp;lt;expression&amp;gt; )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Aug 2014 03:28:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731934#M539921</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-08-23T03:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: 12 months trailing filter</title>
      <link>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731935#M539922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - I am going to put those flags in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I have is I feel like I have to build a duplicate for every chart I have now - or is it better to create some kind of if statement into every expression to address a user clicking the Trailing Twelve Months button.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Aug 2014 14:46:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731935#M539922</guid>
      <dc:creator>zagzebski</dc:creator>
      <dc:date>2014-08-23T14:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: 12 months trailing filter</title>
      <link>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731936#M539923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It depends.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you build the flag i would suggest creating it without an 'else' value ie:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(&amp;nbsp; &amp;lt; date is within last 12 months&amp;gt;&amp;nbsp; , 'True') as&amp;nbsp; 12MonthFlag,&lt;/P&gt;&lt;P&gt;if(&amp;nbsp; &amp;lt; date is within prior year last 12 months&amp;gt;&amp;nbsp; , 'True') as&amp;nbsp; PriorYear12MonthFlag,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this the list box for the flag works like an on/off button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But was is the behaviour you need to see when the 12Monthflag is applied ? &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. Do you need to automativally display the current 12MonthFlag and the prior12MonthFlag side by side in charts ? &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. Do you need to give users the option of showing/hiding the prior12MonthFlag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a few ways to proceed. Most ways will only need 1 chart, not 2 although the expressions will often have IFs or SET ANALYSIS with variables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to keep your chart expressions very basic and you only have to worry about 12Month and PriorYear12Months, you can take the flags a step further and create a special lookup table in the data model to create a calculated field that displays 12Months or prioryear12Months to the users as options to select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assuming you have built your calendar with a 12MonthFlag and priorYear12Monthflag with 1 or 0 in both and assuming its joined on the field 'date' and your calendar table is 'DateCalendar' , create a lookup table like this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CYPY12MonthListBox&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '12 Months'&amp;nbsp; as CYPYListbox,&lt;/P&gt;&lt;P&gt;resident&amp;nbsp; DateCalendar&lt;/P&gt;&lt;P&gt;where 12MonthFlag=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate (CYPY12MonthListBox)&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Prior Year12 Months'&amp;nbsp; as CYPYListbox,&lt;/P&gt;&lt;P&gt;resident&amp;nbsp; DateCalendar&lt;/P&gt;&lt;P&gt;where PriorYear12MonthFlag=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can use the new field CYPYListbox in a listbox or a dimension in a chart . This will give the users the ability to select which period they want to display and the result will display in a chart. Optionally include an 'all dates' in the field by adding this to to the new table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate (CYPY12MonthListBox)&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'All Dates'&amp;nbsp; as CYPYListbox,&lt;/P&gt;&lt;P&gt;resident&amp;nbsp; DateCalendar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would give you 1 chart version of the chart and basic expressions.&amp;nbsp; The code is done in 1 place rather than repetitive IF statements.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There could be other neater UI options as well that don't have a footprint in the data model.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Aug 2014 14:27:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-months-trailing-filter/m-p/731936#M539923</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-08-25T14:27:55Z</dc:date>
    </item>
  </channel>
</rss>

