<?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: complex set analysis Date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586648#M685049</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;OrderStatus={"$(=Max(ComparisonDate)-Max(OrderDate))"}&amp;gt;} OrderAmount)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Feb 2014 14:00:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-02-14T14:00:49Z</dc:date>
    <item>
      <title>complex set analysis Date</title>
      <link>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586647#M685048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I have an application with:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;- orderID&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;- orderStatus (integer value)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;- orderDate&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;- orderAmount&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;- ComparaisonDate (field not linked to the data model)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I need to calculate the sum of orderAmount where orderStatus has increased between a selected max(ComparaisonDate) and max(orderDate).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Regards,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Yacine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 13:26:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586647#M685048</guid>
      <dc:creator />
      <dc:date>2014-02-14T13:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: complex set analysis Date</title>
      <link>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586648#M685049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;OrderStatus={"$(=Max(ComparisonDate)-Max(OrderDate))"}&amp;gt;} OrderAmount)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 14:00:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586648#M685049</guid>
      <dc:creator />
      <dc:date>2014-02-14T14:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: complex set analysis Date</title>
      <link>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586649#M685050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you but this not works. as I know, I don't think comparing &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;OrderStatus&lt;/SPAN&gt; with dates is possible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 14:15:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586649#M685050</guid>
      <dc:creator />
      <dc:date>2014-02-14T14:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: complex set analysis Date</title>
      <link>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586650#M685051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you please post sample qvw.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 14:42:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586650#M685051</guid>
      <dc:creator />
      <dc:date>2014-02-14T14:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: complex set analysis Date</title>
      <link>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586651#M685052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What should happen if OrderStatus didn't increase? Should the sum of OrderAmount be set to zero?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if OrderStatus DID increase, do you want the sum of OrderAmount over the range of months between compareDate and OrderDate? Maybe post an example of what should happen in both scenarios (OrderStatus increase and OrderStatus decrease/stay the same).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 15:30:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586651#M685052</guid>
      <dc:creator />
      <dc:date>2014-02-14T15:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: complex set analysis Date</title>
      <link>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586652#M685053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry if I didn't explain very clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below an example of data :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 331px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl69" height="21" width="80"&gt;&lt;STRONG&gt;orderID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl70" style="border-left: none;" width="80"&gt;&lt;STRONG&gt;orderStatus&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl70" style="border-left: none;" width="80"&gt;&lt;STRONG&gt;orderDate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl71" style="border-left: none;" width="91"&gt;&lt;STRONG&gt;orderAmount&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl72" height="20"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-left: none;"&gt;01/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl73" style="border-left: none;"&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl74" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;30&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;02/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl75" style="border-top: none; border-left: none;"&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl74" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;40&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;03/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl75" style="border-top: none; border-left: none;"&gt;400&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl74" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;50&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;04/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl75" style="border-top: none; border-left: none;"&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl74" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;05/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl75" style="border-top: none; border-left: none;"&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl74" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;60&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;06/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl75" style="border-top: none; border-left: none;"&gt;600&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl74" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;30&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;03/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl75" style="border-top: none; border-left: none;"&gt;700&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl74" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;40&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;04/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl75" style="border-top: none; border-left: none;"&gt;800&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl74" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;05/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl75" style="border-top: none; border-left: none;"&gt;900&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl76" height="21" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl77" style="border-top: none; border-left: none;"&gt;70&lt;/TD&gt;&lt;TD align="right" class="xl78" style="border-top: none; border-left: none;"&gt;06/01/2014&lt;/TD&gt;&lt;TD align="right" class="xl79" style="border-top: none; border-left: none;"&gt;1000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the my first post, I wrote only one part of the problem. now i'm explaining the entire query needed in another way:&lt;/P&gt;&lt;P&gt;I need 2 expressions :&lt;/P&gt;&lt;P&gt;Expression 1) count distinct OrderId where :&lt;/P&gt;&lt;P&gt;- OrderStatus at orderDate &amp;gt; OrderStatus at ComparaisonOrderDate&lt;/P&gt;&lt;P&gt;- orderStatus is not null at the two periods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression 2) sum of orderAmount at orderDate - orderAmount at ComparaisonOrderDate&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;- OrderStatus at orderDate &amp;gt; OrderStatus at ComparaisonOrderDate&lt;/P&gt;&lt;P&gt;- orderStatus is not null at the two periods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples 1:&lt;/P&gt;&lt;P&gt;when I select ComparaisonOrderDate=02/01/2014 and&amp;nbsp; orderDate=04/01/2014&lt;/P&gt;&lt;P&gt;Expression 1 should be: 1 (only orderID=1)&lt;/P&gt;&lt;P&gt;because 50 &amp;gt; 30 and 30 is not null and 50 is not null&lt;/P&gt;&lt;P&gt;Expression 2 should be: 100&lt;/P&gt;&lt;P&gt;200-100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples 2:&lt;/P&gt;&lt;P&gt;when I select &lt;/P&gt;&lt;P&gt;ComparaisonOrderDate=03/01/2014 and&amp;nbsp; orderDate=06/01/2014&lt;/P&gt;&lt;P&gt;Expression 1 should be: 2 (orderID=1 &amp;amp; 2)&lt;/P&gt;&lt;P&gt;because in orderID=1, 60 &amp;gt; 40 and in orderID=2, 70 &amp;gt; 30 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression 2 should be: 500&lt;/P&gt;&lt;P&gt;(600-400) + (1000-700)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Yacine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 17:18:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586652#M685053</guid>
      <dc:creator />
      <dc:date>2014-02-14T17:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: complex set analysis Date</title>
      <link>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586653#M685054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yacine,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you will need to build a complex set analysis expression, with nested set analysis conditions. I'll explain the general idea here, and you will need to implement it with your data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "outer" condition will need to select those Orders that satisfy your "criteria", so the "outer" Set Analysis will be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum ( {&amp;lt;OrderID = {"=criteria"}&amp;gt;}&amp;nbsp; Amount).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the "criteria" inside the search will have to include your actual condition of the increased status:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;only( {&amp;lt;inner condition 1&amp;gt;} Order Status) &amp;gt; only ({&amp;lt;inner condition 2&amp;gt;}) Order Status)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Inner conditions should reflect your date conditions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date = {$(=max(ComparisonOrderDate))}&lt;/P&gt;&lt;P&gt;Date = {$(=max(OrderDate))}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll need to ensure proper date formatting...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There might be a need in a lot of "tinkering" with the syntax and the proper formatting, but this is the general direction...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Come and learn Set Analysis with me at the Masters Summit for QlikView - coming soon to Chicago:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;www.masterssummit.com&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 17:44:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/complex-set-analysis-Date/m-p/586653#M685054</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2014-02-14T17:44:59Z</dc:date>
    </item>
  </channel>
</rss>

