<?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: Subtract Dates with Different Formats in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72961#M770737</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Taher,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="75" style="border: 1px solid rgb(0, 0, 0); border-image: none; width: 170px;"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TH class="header" style="padding: 2px; border: 1px solid #000000; border-image: none; text-align: center; color: #ffffff; background-color: #6690bc;" valign="middle"&gt;&lt;STRONG&gt;Header 1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH class="header" style="padding: 2px; border: 1px solid #000000; border-image: none; text-align: center; color: #ffffff; background-color: #6690bc;" valign="middle"&gt;&lt;STRONG&gt;Header 2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000; border-image: none;"&gt;6/5/2018&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000; border-image: none;"&gt;20-Jun-18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000; border-image: none;"&gt;6/2/2018&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000; border-image: none;"&gt;1-Jul-18&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First date(Header1) is MM/DD/YYYY&lt;/P&gt;&lt;P&gt;Second Date(Header2) is DD-Mon-YYYY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on top of SQL statement , write&amp;nbsp; Load * , Alt (Header1, Date(Date#(Header1,'MM/DD/YYYY)) ,Date(Date#(Header1,'DD-MMM-YYYY))&amp;nbsp; ) AS _Header1,&lt;/P&gt;&lt;P&gt;Alt (Header2, Date(Date#(Header2,'MM/DD/YYYY)) ,Date(Date#(Header2,'DD-MMM-YYYY))&amp;nbsp; ) AS _Header2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jun 2018 07:22:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-06-08T07:22:43Z</dc:date>
    <item>
      <title>Subtract Dates with Different Formats</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72955#M770728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have 2 columns in the Oracle DB having dates with different formats.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First date(Header1) is MM/DD/YYYY&lt;/P&gt;&lt;P&gt;Second Date(Header2) is DD-Mon-YYYY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="75" style="border: 1px solid #000000; width: 172px; height: 77px;" width="170"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Header 1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Header 2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6/5/2018&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;20-Jun-18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6/2/2018&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1-Jul-18&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Qlikview editor i am loading the dates in the below manner from SQL statement so that the dates appear in the standard format for display purpose and this is coming up fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;TO_CHAR(TO_DATE(BILL_DATE, 'DD-Mon-YY'),'DD-MON-YYYY') as ACTUAL_BILLING_DATE,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;TO_CHAR(ALARM_DATE, 'DD-MON-YYYY') as ALARM_DATE,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, in a straight table chart, i want to subtract he dates and get the difference in days only. I tried Date#,Interval and other functions, but nothing seems to be working. Any idea what expression needs to be used?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Taher&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/Subtract-Dates-with-Different-Formats/m-p/72955#M770728</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Dates with Different Formats</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72956#M770730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would create two more fields with date#() and get int values like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(Floor(Date#(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;ACTUAL_BILLING_DATE, 'DD-MON-YYYY))) AS Header1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(Floor(Date#(&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;ALARM_DATE, 'DD-MON-YYYY))) AS Header2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;SELECT Field1,&lt;/P&gt;&lt;P&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; Field2,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&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; TO_CHAR(TO_DATE(BILL_DATE, 'DD-Mon-YY'),'DD-MON-YYYY') as ACTUAL_BILLING_DATE,&lt;/SPAN&gt;&lt;/P&gt;&lt;P 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; TO_CHAR(ALARM_DATE, 'DD-MON-YYYY') as ALARM_DATE&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FROM yoursourcetable; &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Then just use header2 - header1. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 22:10:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72956#M770730</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2018-06-07T22:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Dates with Different Formats</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72957#M770731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this. The editor script got reloaded successfully, but the difference didn't work. &lt;/P&gt;&lt;P&gt;It shows a - in the expression.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;what i did:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;LOAD*,&lt;/P&gt;&lt;P&gt;Num(Floor(Date#(ACTUAL_BILLING_DATE, 'DD-MON-YYYY'))) as Date1,&lt;/P&gt;&lt;P&gt;Num(Floor(Date#(ALARM_MON_YR_DT, 'DD-MON-YYYY'))) as Date2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT:&lt;/P&gt;&lt;P&gt;TO_CHAR(TO_DATE(BILL_DATE, 'DD-Mon-YY'),'DD-MON-YYYY') as ACTUAL_BILLING_DATE,&lt;/P&gt;&lt;P&gt;TO_CHAR(ALARM_DATE, 'DD-MON-YYYY') as ALARM_MON_YR_DT,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reloaded and it was succesfuull.&lt;/P&gt;&lt;P&gt;Then went to Straight table, added the below in calculated dimension:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Date2-Date1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the column just shows a '-'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 22:38:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72957#M770731</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-07T22:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Dates with Different Formats</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72958#M770733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, in your load script you can try with :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date#(SubField(Header2,'-',1)&amp;amp;'/'&amp;amp;date(date#(SubField(Header2,'-',2),'MMMM'),'MM')&amp;amp;'/'&amp;amp;SubField(Header2,'-',3),'DD/MM/YY')-&lt;/P&gt;&lt;P&gt;date#(SubField(Header1,'/',2)&amp;amp;'/'&amp;amp;SubField(Header1,'/',1)&amp;amp;'/'&amp;amp;right(SubField(Header1,'/',3),2),'DD/MM/YY') as duration&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" height="78" src="https://community.qlik.com/legacyfs/online/204632_pastedImage_0.png" style="width: 297px; height: 77.5457px;" width="297" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 22:41:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72958#M770733</guid>
      <dc:creator>sergio0592</dc:creator>
      <dc:date>2018-06-07T22:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Dates with Different Formats</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72959#M770735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Jean&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I selected the 2 date columns as it is and displayed them in the sheet and this is how they are appearing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikDates.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/204627_QlikDates.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I copied below expression in StraightTable calculated dimension:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=date#(SubField(BILL_DATE,'-',1)&amp;amp;'/'&amp;amp;date(date#(SubField(BILL_DATE,'-',2),'MMMM'),'MM')&amp;amp;'/'&amp;amp;SubField(BILL_DATE,'-',3),'DD/MM/YY')-date#(SubField(ALARM_DATE,'/',2)&amp;amp;'/'&amp;amp;SubField(ALARM_DATE,'/',1)&amp;amp;'/'&amp;amp;right(SubField(ALARM_DATE,'/',3),2),'DD/MM/YY')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But its not working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 22:54:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72959#M770735</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-07T22:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Dates with Different Formats</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72960#M770736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Jean,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your solution worked. Thanks a Lot &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Taher&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 23:16:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72960#M770736</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-07T23:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Dates with Different Formats</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72961#M770737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Taher,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="75" style="border: 1px solid rgb(0, 0, 0); border-image: none; width: 170px;"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TH class="header" style="padding: 2px; border: 1px solid #000000; border-image: none; text-align: center; color: #ffffff; background-color: #6690bc;" valign="middle"&gt;&lt;STRONG&gt;Header 1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH class="header" style="padding: 2px; border: 1px solid #000000; border-image: none; text-align: center; color: #ffffff; background-color: #6690bc;" valign="middle"&gt;&lt;STRONG&gt;Header 2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000; border-image: none;"&gt;6/5/2018&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000; border-image: none;"&gt;20-Jun-18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000; border-image: none;"&gt;6/2/2018&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000; border-image: none;"&gt;1-Jul-18&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First date(Header1) is MM/DD/YYYY&lt;/P&gt;&lt;P&gt;Second Date(Header2) is DD-Mon-YYYY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on top of SQL statement , write&amp;nbsp; Load * , Alt (Header1, Date(Date#(Header1,'MM/DD/YYYY)) ,Date(Date#(Header1,'DD-MMM-YYYY))&amp;nbsp; ) AS _Header1,&lt;/P&gt;&lt;P&gt;Alt (Header2, Date(Date#(Header2,'MM/DD/YYYY)) ,Date(Date#(Header2,'DD-MMM-YYYY))&amp;nbsp; ) AS _Header2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2018 07:22:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72961#M770737</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-08T07:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Dates with Different Formats</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72962#M770738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share a sample where you have this issue. Usually Date#() with Num(Floor()) should help in this scenario, but need some sample so that i can give you and expr that works fine. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2018 15:48:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Dates-with-Different-Formats/m-p/72962#M770738</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2018-06-08T15:48:54Z</dc:date>
    </item>
  </channel>
</rss>

