<?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 Date - Problem with selection in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Subtract-Date-Problem-with-selection/m-p/1450178#M434164</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the dates loaded as text or are they correctly loaded as dual() fields?&lt;/P&gt;&lt;P&gt;I ask this because there are spaces in front of the Date &amp;amp; Month for 07/11/2017 in the data you posted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps these posts will help you get the dates loaded correctly.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2954"&gt;Why don’t my dates work?&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2622"&gt;Get the Dates Right&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also it may help you identify the issue if you add test expresions to your table for&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;sum({&amp;lt;Id_operation={'1'}&amp;gt;} Data) &lt;/STRONG&gt;, &lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;sum({&amp;lt;Id_operation={'2'}&amp;gt;} Data) &lt;/STRONG&gt;and &lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;count({&amp;lt;DISTINCT Id_document) &lt;/STRONG&gt;&lt;/STRONG&gt;so you can check those values are correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Nov 2017 12:50:58 GMT</pubDate>
    <dc:creator>Colin-Albert</dc:creator>
    <dc:date>2017-11-10T12:50:58Z</dc:date>
    <item>
      <title>Subtract Date - Problem with selection</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Date-Problem-with-selection/m-p/1450177#M434163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Goodmorning to everyone,&lt;/P&gt;&lt;P&gt;I'm here with a problem without a solution in the community (at least, I didn't find a solution!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a fact table that contain all the operation about a document. The fact is like &lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Id_document&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Id_operation&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Month&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;xxxxyyyy&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31/10/2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;October&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;xxxxyyyy&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01/11/2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;November&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;eeeeffff&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD&gt;07/11/2017&lt;/TD&gt;&lt;TD&gt;November&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;eeeeffff&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;09/11/2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;November&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to calculate the mean time between the operation 1 and 2.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;=sum(aggr(sum({&amp;lt;Id_operation={'2'}&amp;gt;} Data)-sum({&amp;lt;Id_operation={'1'}&amp;gt;} Data),Id_document))/count({&amp;lt;DISTINCT Id_document)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this example, the mean value is 1.5 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;If i select one month (for example november), the value isn't correct (01/11/2017).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i consider only the document with all the operation in the month "November"?&lt;/P&gt;&lt;P&gt;Alternatively, how can i consider also the record with month "October" that have an operation in "November"? &lt;/P&gt;&lt;P&gt;I have to add two more columns (MonthID1 and MonthID2) and move the selection on that field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advice, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards from Italy!&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Nov 2017 09:56:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Date-Problem-with-selection/m-p/1450177#M434163</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-10T09:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Date - Problem with selection</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Date-Problem-with-selection/m-p/1450178#M434164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the dates loaded as text or are they correctly loaded as dual() fields?&lt;/P&gt;&lt;P&gt;I ask this because there are spaces in front of the Date &amp;amp; Month for 07/11/2017 in the data you posted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps these posts will help you get the dates loaded correctly.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2954"&gt;Why don’t my dates work?&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2622"&gt;Get the Dates Right&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also it may help you identify the issue if you add test expresions to your table for&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;sum({&amp;lt;Id_operation={'1'}&amp;gt;} Data) &lt;/STRONG&gt;, &lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;sum({&amp;lt;Id_operation={'2'}&amp;gt;} Data) &lt;/STRONG&gt;and &lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;count({&amp;lt;DISTINCT Id_document) &lt;/STRONG&gt;&lt;/STRONG&gt;so you can check those values are correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Nov 2017 12:50:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Date-Problem-with-selection/m-p/1450178#M434164</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2017-11-10T12:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract Date - Problem with selection</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-Date-Problem-with-selection/m-p/1450179#M434165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The dates are loaded correctly as Date, here i posted only a few example wrote for example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is about Selection. When any Date and any Month aren't selected, the value is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When one month is selected, the value isn't correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see (using the example I posted), if i select "November" i have :&lt;/P&gt;&lt;P&gt;(09/11/2017 +01/11/2017 - 07/11/2017) / 2 = ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2017 08:22:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-Date-Problem-with-selection/m-p/1450179#M434165</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-13T08:22:13Z</dc:date>
    </item>
  </channel>
</rss>

