<?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: Number of Months as a Dim in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529961#M38142</link>
    <description>&lt;P&gt;Well, there are two ways as far as I can tell:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Keep the number of months in an excel spreadsheet (or similar) and load this in your app.&amp;nbsp; Each time the user changes the number of months, they would have to re-load the app.&amp;nbsp; This is obviously very clunky.&lt;/P&gt;&lt;P&gt;2) Create a variable in the load script, e.g. let vMonths = 6 and use the Variable&amp;nbsp;Input component (included as part of the Qlik Sense November 2018 release, but I believe it is available on QlikBranch if&amp;nbsp;you're using a previous version)&amp;nbsp;so that the user can change the variable value, e.g.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VariableRecordFilter.JPG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/3693iC5C3FACAE9722298/image-size/large?v=v2&amp;amp;px=999" role="button" title="VariableRecordFilter.JPG" alt="VariableRecordFilter.JPG" /&gt;&lt;/span&gt;Then you can use the variable in the dimension or measure formula to filter the results, e.g.&lt;/P&gt;&lt;P&gt;dimension&lt;/P&gt;&lt;P&gt;=if(MonthsSinceOrder&amp;lt;=$(vMonths),[Customer Name])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;measure&lt;/P&gt;&lt;P&gt;if(MonthsSinceOrder&amp;lt;=$(vMonths), Sum([Sheet1-1.Sales]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or using set analysis:&amp;nbsp; Sum({&amp;lt;MonthsSinceOrder={"&amp;lt;=$(=vMonths)"}&amp;gt;}[Sheet1-1.Sales])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The records shown change as you change the variable value in the input box.&lt;/P&gt;&lt;P&gt;I've attached an app demonstrating this (you'll need to unzip it).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jan 2019 12:16:33 GMT</pubDate>
    <dc:creator>rbartley</dc:creator>
    <dc:date>2019-01-14T12:16:33Z</dc:date>
    <item>
      <title>Number of Months as a Dim</title>
      <link>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529886#M38134</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I have an Application with sales data. I want to reduce the data dynamically which means I want to filter out customer according to the number of months since their last purchase:&lt;/P&gt;&lt;P&gt;My initial approach was like this: for each customer I know this last date, I can even calculate the number of month between that last date and today and put it as an attribute of a customer. Now, how can I put it as a Dim? For example if I want to show the measures only for the customers who bought in the last 6 months? Or 5?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or is there another approach?&lt;/P&gt;&lt;P&gt;Thx.&lt;/P&gt;&lt;P&gt;Motty&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 09:42:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529886#M38134</guid>
      <dc:creator>sogloqlik</dc:creator>
      <dc:date>2019-01-14T09:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months as a Dim</title>
      <link>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529898#M38135</link>
      <description>&lt;P&gt;Hi Motty,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you only want to show customers with sales in the last x months, then couldn't you just add a condition in the load script to the customer table, e.g.&amp;nbsp;&amp;nbsp;first load the table that includes the attribute showing whether the customer has sales in the last x months then create another table, referencing the first as a Resident with a condition based on this attribute and then drop the first table?&lt;/P&gt;&lt;P&gt;Pseudo code:&lt;/P&gt;&lt;PRE&gt;[All Customers]:
LOAD
Customer ID,
Customer Name,
..
Show_Customer_Flag
from
....


[Recent Customers]:
LOAD
Customer ID,
Customer Name,
...
Resident [All Customers]
Where Show_Customer_Flag = 1;

Drop table [All Customers];


&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 09:56:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529898#M38135</guid>
      <dc:creator>rbartley</dc:creator>
      <dc:date>2019-01-14T09:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months as a Dim</title>
      <link>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529908#M38136</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thx for your answer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If life were that simple&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.qlik.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Of course I could, But my users want to change&amp;nbsp;the X months&amp;nbsp;dynamically. e.g. if they choose 6 months I need to show all the customers who have pouched in the last 6 months(which means 6 is the max number of months) but then they may want to choose 5 months or even a whole year...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 10:12:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529908#M38136</guid>
      <dc:creator>sogloqlik</dc:creator>
      <dc:date>2019-01-14T10:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months as a Dim</title>
      <link>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529961#M38142</link>
      <description>&lt;P&gt;Well, there are two ways as far as I can tell:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Keep the number of months in an excel spreadsheet (or similar) and load this in your app.&amp;nbsp; Each time the user changes the number of months, they would have to re-load the app.&amp;nbsp; This is obviously very clunky.&lt;/P&gt;&lt;P&gt;2) Create a variable in the load script, e.g. let vMonths = 6 and use the Variable&amp;nbsp;Input component (included as part of the Qlik Sense November 2018 release, but I believe it is available on QlikBranch if&amp;nbsp;you're using a previous version)&amp;nbsp;so that the user can change the variable value, e.g.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VariableRecordFilter.JPG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/3693iC5C3FACAE9722298/image-size/large?v=v2&amp;amp;px=999" role="button" title="VariableRecordFilter.JPG" alt="VariableRecordFilter.JPG" /&gt;&lt;/span&gt;Then you can use the variable in the dimension or measure formula to filter the results, e.g.&lt;/P&gt;&lt;P&gt;dimension&lt;/P&gt;&lt;P&gt;=if(MonthsSinceOrder&amp;lt;=$(vMonths),[Customer Name])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;measure&lt;/P&gt;&lt;P&gt;if(MonthsSinceOrder&amp;lt;=$(vMonths), Sum([Sheet1-1.Sales]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or using set analysis:&amp;nbsp; Sum({&amp;lt;MonthsSinceOrder={"&amp;lt;=$(=vMonths)"}&amp;gt;}[Sheet1-1.Sales])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The records shown change as you change the variable value in the input box.&lt;/P&gt;&lt;P&gt;I've attached an app demonstrating this (you'll need to unzip it).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 12:16:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1529961#M38142</guid>
      <dc:creator>rbartley</dc:creator>
      <dc:date>2019-01-14T12:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months as a Dim</title>
      <link>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1530030#M38143</link>
      <description>&lt;P&gt;I'm not sure what happened here.&amp;nbsp; I posted an update but it doesn't seem to have been added.&amp;nbsp; Anyway here goes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;I think the most flexible solution&amp;nbsp; would be to use the Variable Input component that comes as standard with the November 2018 version of Qlik Sense (and I believe you can download from QlikBranch is using an earlier version.&lt;/P&gt;&lt;P&gt;First, create a variable to hold the user input value indicating the maximum number of months since the customer purchased, e.g.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let vMonth = 6;&lt;/P&gt;&lt;P&gt;Now add the Variable Input component to your sheet and change the definition of your Customer list and Sales measure, e.g.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VariableRecordFilter.JPG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/3693iC5C3FACAE9722298/image-size/large?v=v2&amp;amp;px=999" role="button" title="VariableRecordFilter.JPG" alt="VariableRecordFilter.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;List definition:&amp;nbsp;=if(MonthsSinceOrder&amp;lt;=$(vMonths),[Customer Name])&lt;/P&gt;&lt;P&gt;Sales definition:&amp;nbsp;Sum({&amp;lt;MonthsSinceOrder={"&amp;lt;=$(=vMonths)"}&amp;gt;}[Sheet1-1.Sales])&lt;/P&gt;&lt;P&gt;Both the list and the table including the sales changes with the value entered in the Variable Input box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached an example app (you will need to unzip) that shows this in action.&amp;nbsp; Just change the number in the input box to see the effect.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 13:47:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1530030#M38143</guid>
      <dc:creator>rbartley</dc:creator>
      <dc:date>2019-01-14T13:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months as a Dim</title>
      <link>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1530032#M38144</link>
      <description>&lt;P&gt;I found this on QlikBranch in case you don't have QS November 2018:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.qlik.com/garden/5ac921580f9f4d1cc1e0c168" target="_blank"&gt;https://developer.qlik.com/garden/5ac921580f9f4d1cc1e0c168&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't tried it though.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 13:53:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1530032#M38144</guid>
      <dc:creator>rbartley</dc:creator>
      <dc:date>2019-01-14T13:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months as a Dim</title>
      <link>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1530081#M38151</link>
      <description>&lt;P&gt;Thx for the input.&lt;/P&gt;&lt;P&gt;I will check it.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 15:12:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Number-of-Months-as-a-Dim/m-p/1530081#M38151</guid>
      <dc:creator>sogloqlik</dc:creator>
      <dc:date>2019-01-14T15:12:34Z</dc:date>
    </item>
  </channel>
</rss>

