<?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: Date function not functioning properly in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455315#M794031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is because the $-sign substitution places the QlikView expression in a SQL SELECT statement instead of the calculated value. That won't work as most if not all RDBMS do not understand QlikView functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that you stuffed the string &lt;SPAN style="font-family: 'courier new', courier;"&gt;"= Date(Today()-1, 'YYYYMMDD')"&lt;/SPAN&gt; in variable currentdate, instead of a value like &lt;SPAN style="font-family: 'courier new', courier;"&gt;"20180114"&lt;/SPAN&gt; (yesterdays date). Are you sure the answer you posted to Clevers question is correct? It doesn't look like it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the current value of currentdate in Settings-&amp;gt;Variable overview. What script statement did you really use to initialise that variable? Also check whether there aren't multiple statements that try to set currentdate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jan 2018 08:57:53 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2018-01-16T08:57:53Z</dc:date>
    <item>
      <title>Date function not functioning properly</title>
      <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455308#M794021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;when i am seeing my sold_date field in my dasboard its giving correct values of date till 2017 but not for 2018(attached image)&lt;/P&gt;&lt;P&gt;why? When I am selecting sold_date the format for 2018 date is changed and sold_year field which is derived from sold_date is not updated with date 2018 why?&lt;/P&gt;&lt;P&gt;this is a following script:-&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;OLEDB&lt;/SPAN&gt; &lt;STRONG style="color: blue; font-size: 11.0pt; font-family: 'Courier New';"&gt;CONNECT&lt;/STRONG&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;TO&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Initial Catalog=ETPEAS;Data Source=192.168.1.70;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=QLIKVIEW;Use Encryption for Data=False;Tag with column collation when possible=False]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;XPassword&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;is&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; XEDJTZFMLB);&lt;BR /&gt; &lt;BR /&gt; Increment_Sales:&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Concatenate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(POS_Master_final)&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 11.0pt; font-family: 'Courier New';"&gt;Load&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;Warehouse&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;ETPCode&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;InvoiceNumber&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[inv no]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;CreateDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, 'YYYYMMDD') &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;Sold_Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;month&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;CreateDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, 'YYYYMMDD')) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;Sold_Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;year&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;CreateDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, 'YYYYMMDD')) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;Sold_Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;replace&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;ItemNumber&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,' ','') &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;itemnumber&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;left&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;ItemNumber&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,3) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Season Code]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;InvoiceQuantity&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;quantity_sold&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;SalesPrice&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[sales price]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[inv value]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;500, '&amp;lt;500', &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;800, '500-799',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;1200, '800-1199',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;1600,'1200-1599',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;2500,'1600-2499',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;3500,'2500-3499',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;5000,'3500-4999','&amp;gt;=5000'))))))) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Inv val Bucket]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;VatAmount&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[tax amount]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 11.0pt; font-family: 'Courier New';"&gt;SQL&lt;/STRONG&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;FROM&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;ETPEAS.dbo.CashOrderTrn&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;InvoiceType&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;'31'&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;and&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;(CreateDate&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;20130101&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;and&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;CreateDate&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;'$(currentdate)')&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ;&lt;BR /&gt; &lt;BR /&gt; Increment_Returns:&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Concatenate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(POS_Master_final)&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 11.0pt; font-family: 'Courier New';"&gt;LOAD&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;Warehouse&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;ETPCode&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;SalesReturnNumber&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[return no]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;Date#(CreateDate, 'YYYYMMDD') as Sold_Date,&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;month&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;CreateDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, 'YYYYMMDD')) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;Sold_Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;year&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;CreateDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, 'YYYYMMDD')) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;Sold_Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;replace&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;ReturnItemNumber&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,' ','') &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;itemnumber&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;left&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;ReturnItemNumber&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,3) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Season Code]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;ReturnQuantity&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;quantity_returns&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;SalesPrice&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[sales price]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; -&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[inv value]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;500, '&amp;lt;500', &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;800, '500-799',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;1200, '800-1199',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;1600,'1200-1599',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;2500,'1600-2499',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;3500,'2500-3499',&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ( &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;LocalAmount&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;5000,'3500-4999','&amp;gt;=5000'))))))) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Inv val Bucket]&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 11.0pt; font-family: 'Courier New';"&gt;SQL&lt;/STRONG&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;FROM&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;ETPEAS.dbo.SalesReturnTrn&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;InvoiceType&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;'31'&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;and&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;(CreateDate&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;20130101&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;and&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;CreateDate&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: lime;"&gt;'$(currentdate)')&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; ;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="font-size: 18pt;"&gt;master calender&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 18pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;for i=2013 to 2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;for j=1 to 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;step1:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;RecNo(),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;MakeDate($(i),$(j),RecNo()) as Sold_Date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;AutoGenerate(31);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;NEXT j;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;NEXT i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;step2:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LOAD Sold_Date, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;year(Sold_Date) as year,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;month(Sold_Date) as Month,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Date(monthstart(Sold_Date), 'MM-YYYY') as MonthYear,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;day(Sold_Date) as Day,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;QuarterName(Sold_Date) as Quater1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;WeekDay(Sold_Date) as weekday,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if(Ceil(Month(Sold_Date)/3)=1,'Q1',IF(Ceil(Month(Sold_Date)/3)=2,'Q2',IF(Ceil(Month(Sold_Date)/3)=3,'Q3',IF(Ceil(Month(Sold_Date)/3)=4,'Q4')))) as Quarter&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;date(Sold_Date) as OrderDate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Resident step1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;drop Table step1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455308#M794021</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Date function not functioning properly</title>
      <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455309#M794022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do you calculate &lt;SPAN style="color: #00ff00; font-family: 'Courier New'; font-size: 14.6667px;"&gt;currentdate?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jan 2018 10:48:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455309#M794022</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2018-01-12T10:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Date function not functioning properly</title>
      <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455310#M794025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 11pt; font-family: 'Courier New'; color: blue;"&gt;Alt(Date(Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt; font-family: 'Courier New'; color: maroon;"&gt;CreateDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt; font-family: 'Courier New'; color: black;"&gt;, 'YYYYMMDD')), Date(Num(CreateDate))) &lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt; font-family: 'Courier New'; color: maroon;"&gt;Sold_Date&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 11pt; font-family: 'Courier New'; color: black;"&gt;&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jan 2018 10:48:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455310#M794025</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-01-12T10:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Date function not functioning properly</title>
      <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455311#M794026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Let&lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt;"&gt;&lt;EM style="color: gray; font-size: 11.0pt; font-family: 'Courier New';"&gt;currentdate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt; =&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black;"&gt;(1)-1,'YYYYMMDD');&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 09:19:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455311#M794026</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-15T09:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Date function not functioning properly</title>
      <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455312#M794028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saksham,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is your Sold_Date in Fact table giving the correct value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kamal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 09:37:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455312#M794028</guid>
      <dc:creator>kamalqlik</dc:creator>
      <dc:date>2018-01-15T09:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Date function not functioning properly</title>
      <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455313#M794029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at this post on dates. &lt;A href="https://community.qlik.com/qlik-blogpost/4002"&gt;The Date Function&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You may want to use Date(Date#(....)) to ensure your dates are processed consistently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. In Increment Returns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;change the line&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date#(CreateDate, 'YYYYMMDD') as Sold_Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;to&amp;nbsp; &lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Date#(CreateDate, 'YYYYMMDD')) as Sold_Date,&lt;/STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 15:57:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455313#M794029</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2018-01-15T15:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Date function not functioning properly</title>
      <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455314#M794030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here currentdate is not working in script&lt;/P&gt;&lt;P&gt;&lt;IMG alt="painterrrrrooorrrr.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/190186_painterrrrrooorrrr.png" style="height: 349px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Incremental_Non_Etp_Returns:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Concatenate(POS_Master_final)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; Load &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; //ApplyMap('SAPCODE_ETPCodeMapping',NCode,'') as ETPCode,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp; NCode as SAPCode,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InvoiceNumber as [return no],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(SalesDate, 'YYYYMMDD') as Sold_Date,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; month(Date#(SalesDate, 'YYYYMMDD')) as Sold_Month,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; year(Date#(SalesDate, 'YYYYMMDD')) as Sold_Year,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace(ItemNumber,' ','') as itemnumber, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; left(ItemNumber,3) as [Season Code],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //'N_ETP SALE' as SaleType,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SaleQuantity as quantity_returns,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -NetValue as [inv value],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MRPValue as [sales price],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( NetValue &amp;lt;500, '&amp;lt;500', if ( NetValue &amp;lt;800, '500-799',if ( NetValue &amp;lt;1200, '800-1199',if ( NetValue &amp;lt;1600,'1200-1599',if ( NetValue &amp;lt;2500,'1600-2499',if ( NetValue &amp;lt;3500,'2500-3499',if ( NetValue &amp;lt;5000,'3500-4999','&amp;gt;=5000'))))))) as [Inv val Bucket],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -TaxAmount as [tax amount];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;SQl Select WH.GoodsSender as NCode, SD.InvoiceNumber, SD.SalesDate,SD.ItemNumber,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;SD.SaleQuantity, SD.NetValue,SD.MRPValue,SD.TaxAmount &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;FROM SAP_Link.dbo.Sales_DataNonETP_BIReports SD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;INNER JOIN ETPEASV55.dbo.warehouse_sap_bireport WH&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;ON SD.CustomerId=WH.Warehouse &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;where SD.Doc_Type = 'ZIKR' and SD.SalesDate &amp;gt;= 20130101 and SD.SalesDate &amp;lt;= '&lt;STRONG style="text-decoration: underline;"&gt;&lt;EM&gt;$(currentdate)' ;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jan 2018 07:40:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455314#M794030</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-16T07:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Date function not functioning properly</title>
      <link>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455315#M794031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is because the $-sign substitution places the QlikView expression in a SQL SELECT statement instead of the calculated value. That won't work as most if not all RDBMS do not understand QlikView functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that you stuffed the string &lt;SPAN style="font-family: 'courier new', courier;"&gt;"= Date(Today()-1, 'YYYYMMDD')"&lt;/SPAN&gt; in variable currentdate, instead of a value like &lt;SPAN style="font-family: 'courier new', courier;"&gt;"20180114"&lt;/SPAN&gt; (yesterdays date). Are you sure the answer you posted to Clevers question is correct? It doesn't look like it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the current value of currentdate in Settings-&amp;gt;Variable overview. What script statement did you really use to initialise that variable? Also check whether there aren't multiple statements that try to set currentdate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jan 2018 08:57:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-function-not-functioning-properly/m-p/1455315#M794031</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2018-01-16T08:57:53Z</dc:date>
    </item>
  </channel>
</rss>

