<?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: if statement and date functions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941415#M528235</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YEAR_NO={$(vCurrentYear), CreateDate = {"&amp;gt;$(=Date(Today() - 60))"}&amp;gt;} OPEN_QN_FLG), 0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Sep 2015 14:17:35 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2015-09-25T14:17:35Z</dc:date>
    <item>
      <title>if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941414#M528233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to make a chart like the one below.&amp;nbsp; I have many fields, two of which are: Open QNs (a columns of 0s and 1s, 0 meaning the QN is not open and 1 meaning that the QN is open, so we care about the 1s) and Createdate (when the QN was created, in number format).&amp;nbsp; I assigned a variable for each year.&amp;nbsp; For 2015 for example, this is my expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(today() - CreateDate &amp;gt;60, &lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&amp;lt;YEAR_NO={$(vCurrentYear)}&amp;gt;}&lt;/P&gt;&lt;P&gt;OPEN_QN_FLG), 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically for each year, I want a sum of all of the open flags (1s) that have been opened for more than 60 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone 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;&lt;IMG alt="open QNs.png" class="jive-image image-1" src="/legacyfs/online/100070_open QNs.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 14:13:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941414#M528233</guid>
      <dc:creator />
      <dc:date>2015-09-25T14:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941415#M528235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YEAR_NO={$(vCurrentYear), CreateDate = {"&amp;gt;$(=Date(Today() - 60))"}&amp;gt;} OPEN_QN_FLG), 0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 14:17:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941415#M528235</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-09-25T14:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941416#M528236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on the chart you show above I'm not sure why you need to have year as part of your set analysis expression (instead of as a dimension). Can you instead do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension: YEAR_NO&lt;/P&gt;&lt;P&gt;Expression: &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum({&amp;lt;CreateDate = {"&amp;lt;$(=Date(Today() - 60))"}&amp;gt;} OPEN_QN_FLG)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Camile&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 14:25:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941416#M528236</guid>
      <dc:creator>cjohnson</dc:creator>
      <dc:date>2015-09-25T14:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941417#M528238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&amp;nbsp; Now, the problem is that the create date is a 5 digit number with many decimals, and the date is not.&amp;nbsp; So i made the following variable:&lt;/P&gt;&lt;P&gt;LET v60Days = floor(today(1)) - 60;&lt;/P&gt;&lt;P&gt;So my new equation is:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YEAR_NO={$(vCurrentYear), CreateDate = {$(v60Days)}&amp;gt;} OPEN_QN_FLG), 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am still getting "No Data to Display" on the chart.&amp;nbsp; I think it is because I need to floor the create date?&amp;nbsp; Do you know how to do that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 14:49:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941417#M528238</guid>
      <dc:creator />
      <dc:date>2015-09-25T14:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941418#M528239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you don't need the time part (decimal) of the CreateDate you can remove in the script using&lt;/P&gt;&lt;P&gt;Floor(CreatedDate) as CreatedDate &lt;/P&gt;&lt;P&gt;or Date(&lt;SPAN style="font-size: 13.3333px;"&gt;Floor(CreatedDate)) as CreatedDate &lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also check the CreatedDate and the bold have the same format (both number or both date) &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum({&amp;lt;YEAR_NO={$(vCurrentYear), CreateDate = {"&amp;gt;&lt;STRONG&gt;$(=Date(Today() - 60))&lt;/STRONG&gt;"}&amp;gt;} OPEN_QN_FLG), 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 17:50:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941418#M528239</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-09-25T17:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941419#M528241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need the CreatedDate to be in the current format with the decimals for some other stuff I am doing, so do not want to change it in the overall script because it would affect other stuff. So just for this instance, how do I make that field the same format as the date (&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #f2f2f2;"&gt;LET v60Days = floor(today(1)) - 60;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 18:47:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941419#M528241</guid>
      <dc:creator />
      <dc:date>2015-09-25T18:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941420#M528242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Channing,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of using the today() function why don't you try using the now() function? That will give you a timestamp instead of date so in number format (num(now()) would include decimals (like your createdate field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="image34.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100094_image34.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;If you use the function now(0) it will be evaluated based on the script execution..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Camile&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 19:02:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941420#M528242</guid>
      <dc:creator>cjohnson</dc:creator>
      <dc:date>2015-09-25T19:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941421#M528244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum({&amp;lt;YEAR_NO={$(vCurrentYear), CreateDate={"&amp;gt;&lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;$(=(Today() - 60))&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;"}&amp;gt;} OPEN_QN_FLG), 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 19:08:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941421#M528244</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-09-25T19:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941422#M528245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't work .. probably because create date is a number and TODAY() - 60 probably returns date format i'm guessing??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 19:16:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941422#M528245</guid>
      <dc:creator />
      <dc:date>2015-09-25T19:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: if statement and date functions</title>
      <link>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941423#M528247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;today()-60 should be a number, try in a textbox or char; you can add a num but I think it doesn't change&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 19:24:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/if-statement-and-date-functions/m-p/941423#M528247</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-09-25T19:24:46Z</dc:date>
    </item>
  </channel>
</rss>

