<?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: Dynamic Date Ranges in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513911#M36627</link>
    <description>&lt;P&gt;Something like this should work:&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE&gt;FactTable:
LOAD Date(Date#(Date, 'YYYY/MMM'),'MM/YYYY') as Date, &lt;BR /&gt;     Charges
FROM
[C:\Users\admin\Desktop\Example.xlsx]
(ooxml, embedded labels, table is Sheet1);

left join

tmp1:
Load max(Date) as max Resident FactTable;&lt;/PRE&gt;&lt;P&gt;Chartdimension:&lt;/P&gt;&lt;PRE&gt;=If(Date &amp;gt; Date(MonthStart(Date(max,'YYYY/MM'), -6),'YYYY/MM') and Date &amp;lt;= Date(max,'YYYY/MM'), Date)&lt;/PRE&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;PRE&gt;sum(Charges)&lt;/PRE&gt;</description>
    <pubDate>Wed, 28 Nov 2018 20:59:39 GMT</pubDate>
    <dc:creator>Frank_Hartmann</dc:creator>
    <dc:date>2018-11-28T20:59:39Z</dc:date>
    <item>
      <title>Dynamic Date Ranges</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513876#M36625</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Context&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I'm developing an app which generates graphs from data in an excel document each month. Instead of having the end-user change the date format in the source document each month, I created a field in the app which interprets and converts the date format into a date field (See below code).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;One of the graphs displays the amount of charges (Measure) each month (Dimension). However, the graph shows 8 months and the user has requested the graph to show the last 6 months. How do I make the graph (1) display the last 6 months and (2) make the expression dynamic so it automatically displays the last 6 months when I upload new data each month?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Date(Date#(Date, 'YYYY/MMM'),'MM/YYYY')&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 19:56:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513876#M36625</guid>
      <dc:creator>Austin</dc:creator>
      <dc:date>2018-11-28T19:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Date Ranges</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513911#M36627</link>
      <description>&lt;P&gt;Something like this should work:&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE&gt;FactTable:
LOAD Date(Date#(Date, 'YYYY/MMM'),'MM/YYYY') as Date, &lt;BR /&gt;     Charges
FROM
[C:\Users\admin\Desktop\Example.xlsx]
(ooxml, embedded labels, table is Sheet1);

left join

tmp1:
Load max(Date) as max Resident FactTable;&lt;/PRE&gt;&lt;P&gt;Chartdimension:&lt;/P&gt;&lt;PRE&gt;=If(Date &amp;gt; Date(MonthStart(Date(max,'YYYY/MM'), -6),'YYYY/MM') and Date &amp;lt;= Date(max,'YYYY/MM'), Date)&lt;/PRE&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;PRE&gt;sum(Charges)&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Nov 2018 20:59:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513911#M36627</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2018-11-28T20:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Date Ranges</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513925#M36628</link>
      <description>&lt;P&gt;1. Do I enter the chart expression under&amp;nbsp;&lt;STRONG&gt;Sorting --&amp;gt; Date --&amp;gt; Sort by expression&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;2. I didn't use a script--I created the date field manually. Where is the option to write scripts located?&lt;BR /&gt;&lt;BR /&gt;Excuse the additional question, I'm brand new to Qlik Sense and have been unable to locate any lists of functions or even good training materials.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 22:18:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513925#M36628</guid>
      <dc:creator>Austin</dc:creator>
      <dc:date>2018-11-28T22:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Date Ranges</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513937#M36630</link>
      <description>&lt;P&gt;Sorry didnt realized that you are working on QlikSense.&lt;/P&gt;&lt;P&gt;Without changing the script (which you can call by clicking on the upperleft navigation button and select dataeditor)&lt;/P&gt;&lt;P&gt;you can use this expression for the dimension on &lt;STRONG&gt;data&lt;/STRONG&gt; tab (&lt;STRONG&gt;not sorting tab&lt;/STRONG&gt;!!)&lt;/P&gt;&lt;PRE&gt;If(Date &amp;gt; MonthStart(Date(max(Total Date),'YYYY/MM'),-6) and Date &amp;lt;= Date(max(Total Date),'YYYY/MM'), Date)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As KPI (&lt;STRONG&gt;on data tab&lt;/STRONG&gt;) use this expression:&lt;/P&gt;&lt;PRE&gt;sum(Charges)&lt;/PRE&gt;&lt;P&gt;This will show you the last 6 month!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 23:07:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Date-Ranges/m-p/1513937#M36630</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2018-11-28T23:07:13Z</dc:date>
    </item>
  </channel>
</rss>

