<?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: Usage between dates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757852#M1049407</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It could be treating one as date and other as number. Can you upload a sample file?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Nov 2014 16:45:06 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-11-03T16:45:06Z</dc:date>
    <item>
      <title>Usage between dates</title>
      <link>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757851#M1049406</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 am facing a problem while calculating the usage between two dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have two dates.&amp;amp; Days fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vReportDate -&amp;nbsp; defined as a variable &lt;/P&gt;&lt;P&gt;StartDate - calculated as an expression inside a straight table.&lt;/P&gt;&lt;P&gt;Days - calculated as an expression inside a straight table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Days = mod(fabs(Date( vReportDate,'DD/MM/YYYY')) - fabs(Date([Activation Date],'DD/MM/YYYY')),30)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; StartDate = Date(vReportDate - [Days],'YYYY-MM-DD')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Total Usage = &lt;/P&gt;&lt;P&gt;SUM(IF([Air Bag Tracking Date] &amp;gt;= [StartDate]&lt;/P&gt;&lt;P&gt;AND [Air Bag Tracking Date] &amp;lt;= DATE(vReportDate ,'YYYY-MM-DD') &lt;/P&gt;&lt;P&gt;AND [IN_COUNTER_TYPE] = 'AC.Airbag_Voice_Min_Daily_Cap_Counter' &lt;/P&gt;&lt;P&gt;AND [IN_UPDATE_TYPE] = 2 ,[Air Bag Amount]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i can successfully build the expressions for Days and startDate, but when i am trying to use them in another expression to calculate the total usage between StartDate and vReportDate, the output is ZERO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However i try changing the formats of the date, its still the same..i am badly stuck here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Help would be deeply appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 16:37:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757851#M1049406</guid>
      <dc:creator />
      <dc:date>2014-11-03T16:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Usage between dates</title>
      <link>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757852#M1049407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It could be treating one as date and other as number. Can you upload a sample file?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 16:45:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757852#M1049407</guid>
      <dc:creator />
      <dc:date>2014-11-03T16:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Usage between dates</title>
      <link>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757853#M1049408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Likely your if() statement is always evaluating to false.&amp;nbsp; Its PROBABLY (not sure) something to do with '&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;([Air Bag Tracking Date] &amp;gt;= [StartDate]'&amp;nbsp; part of the condition.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;You could try putting this in an expression &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SUM(IF([Air Bag Tracking Date] &amp;gt;= [StartDate]&lt;/SPAN&gt; , &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; [StartDate] ,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Air Bag Tracking Date])&amp;nbsp; to figure out what this is evaluating too in your expression. If you see something unexpected you'll need to tweak the formula.&amp;nbsp;&amp;nbsp; Post the result or the whole QVW so it can be directly evaluated. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 16:45:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757853#M1049408</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-11-03T16:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Usage between dates</title>
      <link>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757854#M1049409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri',sans-serif; color: #385623;"&gt;Hi Jonathan,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri',sans-serif; color: #385623;"&gt;Thanks for your response. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri',sans-serif; color: #385623;"&gt;I have checked with the expression &lt;STRONG&gt;SUM(IF([Air Bag Tracking Date] &amp;gt;= [StartDate] , [StartDate] ,[Air Bag Tracking Date]))&lt;/STRONG&gt; and I see some numbers which I am not sure of.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri',sans-serif; color: #385623;"&gt;Yes, I understand the problem is with the&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #666666; font-size: 8pt; font-family: 'Helvetica',sans-serif;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;([Air Bag Tracking Date] &amp;gt;= [StartDate]'&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Calibri',sans-serif; color: #385623;"&gt;expression. i am stuck here.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri',sans-serif; color: #385623;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri',sans-serif; color: #385623;"&gt;Any suggestions or alternative logic to handle the situation. Please assist me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri',sans-serif; color: #385623;"&gt;Attaching the sample qvw for your assistance.&amp;nbsp; Please refer to the “AirBag Voice(Mins) - New Activations” straight table.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 02:37:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757854#M1049409</guid>
      <dc:creator />
      <dc:date>2014-11-04T02:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Usage between dates</title>
      <link>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757855#M1049410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi - i had to remove the 'Days1' reference from the AirBag(mins) expression. It didn't like it for some reason. When you right out the whole expression for Days1 instead it works fine...&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider making Days1 as a variable if you want to manage the expression in one place, just because this make you have the definition in 2 places.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the modified expression: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-SUM( IF( Date([Air Bag Tracking Date]) &amp;gt;=&amp;nbsp; Date(vReportDate - mod(fabs(Date( vReportDate,'DD/MM/YYYY')) - fabs(Date([Activation Date],'DD/MM/YYYY')),30) )&lt;/P&gt;&lt;P&gt;AND Date([Air Bag Tracking Date]) &amp;lt;= DATE(vReportDate ,'YYYY-MM-DD') &lt;/P&gt;&lt;P&gt;AND [IN_COUNTER_TYPE] = 'AC.Airbag_Voice_Min_Daily_Cap_Counter' &lt;/P&gt;&lt;P&gt;AND [IN_UPDATE_TYPE] = 2 ,&lt;/P&gt;&lt;P&gt;[Air Bag Amount]))/1000/60&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/70435_Capture.PNG.png" style="width: 620px; height: 313px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 03:58:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757855#M1049410</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-11-04T03:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Usage between dates</title>
      <link>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757856#M1049411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks alot jonathan, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its working now. you saved my day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 06:13:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Usage-between-dates/m-p/757856#M1049411</guid>
      <dc:creator />
      <dc:date>2014-11-04T06:13:48Z</dc:date>
    </item>
  </channel>
</rss>

