<?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:Help with dates. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207406#M1208903</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got everything working the way that Rob suggested. But your post raised this question, is the system going to know how to handle the output when running the report in Jan?&lt;/P&gt;&lt;P&gt;Or would it give me non-existant data from 2010/12, 2010/11...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Dec 2009 03:52:12 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-12-24T03:52:12Z</dc:date>
    <item>
      <title>Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207398#M1208895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all!&lt;/P&gt;&lt;P&gt;Well, I'm pretty new to Qv, so go easy on me.&lt;/P&gt;&lt;P&gt;I'm having some issues understanding the way that Qv handles dates... what I'm trying to do is select records where the date is equal to the current month on my system. The data is in YYYY/MM.... I was trying to do GETDATE() with MID functions to extract the 'year'+/+'mo'. But to no avail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 01:58:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207398#M1208895</guid>
      <dc:creator />
      <dc:date>2009-12-24T01:58:49Z</dc:date>
    </item>
    <item>
      <title>Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207399#M1208896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use TODAY() to get date, and SUBFIELD instead of MID.&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 02:13:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207399#M1208896</guid>
      <dc:creator />
      <dc:date>2009-12-24T02:13:41Z</dc:date>
    </item>
    <item>
      <title>Re:Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207400#M1208897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What format is the TODAY() output in?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 02:17:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207400#M1208897</guid>
      <dc:creator />
      <dc:date>2009-12-24T02:17:42Z</dc:date>
    </item>
    <item>
      <title>Re:Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207401#M1208898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post a small snippet of your data? I'm not quite sure what you're asking... thanks!&lt;/P&gt;&lt;P&gt;Also, check out the QlikView help, search for "Date and Time Functions", tons of great info there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 02:36:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207401#M1208898</guid>
      <dc:creator />
      <dc:date>2009-12-24T02:36:41Z</dc:date>
    </item>
    <item>
      <title>Re:Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207402#M1208899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I run the report I need to see totals from the current month, as well as the previous 3 months. Like I said, my data is stored as YYYY/MM (2009/12, 2009/11, 2009/10....)&lt;/P&gt;&lt;P&gt;When I enter...&lt;/P&gt;&lt;P&gt;SQL SELECT * FROM blahblah&lt;/P&gt;&lt;P&gt;WHERE YearMonth='2009/12'&lt;/P&gt;&lt;P&gt;...I get the correct output. But I want to change the WHERE clause to be a variable that automatically changes the output from month-to-month.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 02:52:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207402#M1208899</guid>
      <dc:creator />
      <dc:date>2009-12-24T02:52:09Z</dc:date>
    </item>
    <item>
      <title>Re:Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207403#M1208900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;should it look like this?&lt;/P&gt;&lt;P&gt;WHERE YearMonth='year(left(YearMonth,4))'+'/'+'month(right(YearMonth,2))'&lt;/P&gt;&lt;P&gt;Also, do I have to convert to int before I can subtract for previous months?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 03:19:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207403#M1208900</guid>
      <dc:creator />
      <dc:date>2009-12-24T03:19:20Z</dc:date>
    </item>
    <item>
      <title>Re:Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207404#M1208901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to set the SQL WHERE clause to the current month, in your specified format, you can do it like this:&lt;/P&gt;&lt;P&gt;LET currentMonth = date(today(), 'YYYY/MM');&lt;/P&gt;&lt;P&gt;SQL SELECT * FROM blahblah&lt;BR /&gt;WHERE YearMonth='$(currentMonth)'&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;And multiple months like this:&lt;/P&gt;&lt;P&gt;LET currentMonth = date(today(), 'YYYY/MM');&lt;BR /&gt;LET month1 = date(AddMonths(today(),-1), 'YYYY/MM');&lt;/P&gt;&lt;P&gt;SQL SELECT * FROM blahblah&lt;BR /&gt;WHERE YearMonth IN ('$(currentMonth)', '$(month1)')&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 03:22:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207404#M1208901</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-12-24T03:22:20Z</dc:date>
    </item>
    <item>
      <title>Re:Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207405#M1208902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;(Edit: Beaten to the punch. I should have refreshed before posting.)&lt;/P&gt;&lt;P&gt;OK, so in your SQL database, you stored the YearMonth as a TEXT field like '2009/12'. You want to load the current month and the most recent three months. So since today is in month 2009/12, you want your select to include:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;WHERE YearMonth IN ('2009/12','2009/11','2009/10','2009/09')&lt;/P&gt;&lt;P&gt;And then on January 1, you want it to automatically change to:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;WHERE YearMonth IN ('2010/01','2009/12','2009/11','2009/10')&lt;/P&gt;&lt;P&gt;If so, then yes, you could handle it in the DBMS with getdate() and the like. But yes, you can also handle it by building a variable in your script.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;LET MonthList = '(' &amp;amp; CHR(39) &amp;amp; date( today() ,'YYYY/MM') &amp;amp; CHR(39)&lt;BR /&gt; &amp;amp; ',' &amp;amp; CHR(39) &amp;amp; date(addmonths(today(),-1),'YYYY/MM') &amp;amp; CHR(39)&lt;BR /&gt; &amp;amp; ',' &amp;amp; CHR(39) &amp;amp; date(addmonths(today(),-2),'YYYY/MM') &amp;amp; CHR(39)&lt;BR /&gt; &amp;amp; ',' &amp;amp; CHR(39) &amp;amp; date(addmonths(today(),-3),'YYYY/MM') &amp;amp; CHR(39) &amp;amp; ')';&lt;/P&gt;&lt;P&gt;And then referencing the variable in your select:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;SQL SELECT * FROM blahblah&lt;BR /&gt;WHERE YearMonth IN $(MonthList)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 03:42:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207405#M1208902</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-12-24T03:42:05Z</dc:date>
    </item>
    <item>
      <title>Re:Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207406#M1208903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got everything working the way that Rob suggested. But your post raised this question, is the system going to know how to handle the output when running the report in Jan?&lt;/P&gt;&lt;P&gt;Or would it give me non-existant data from 2010/12, 2010/11...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 03:52:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207406#M1208903</guid>
      <dc:creator />
      <dc:date>2009-12-24T03:52:12Z</dc:date>
    </item>
    <item>
      <title>Re:Help with dates.</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207407#M1208904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It'll work fine. QlikView is smart enough to know that when you subtract a month from a January 2010 date that you should get a December 2009 date.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 03:57:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-dates/m-p/207407#M1208904</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-12-24T03:57:43Z</dc:date>
    </item>
  </channel>
</rss>

