<?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: Count between two dates set analysis not working in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618974#M63329</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might want to try this&lt;/P&gt;&lt;P&gt;Count({&amp;lt;Order_Number = {"([Shipdate]&amp;gt;=[OrderDate] AND [Shipdate]&amp;lt;=[DueDate])"}&amp;gt;}Distinct Order_Number)&lt;/P&gt;</description>
    <pubDate>Fri, 30 Aug 2019 19:22:33 GMT</pubDate>
    <dc:creator>chriscammers</dc:creator>
    <dc:date>2019-08-30T19:22:33Z</dc:date>
    <item>
      <title>Count between two dates set analysis not working</title>
      <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618963#M63326</link>
      <description>&lt;P&gt;I have three dates Ship Date, Order Date and Due Date and I am doing set analysis to count the # of orders that have a ship date between the Order and Due Date like so;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;count(Distinct {&amp;lt;[Shipdate]={"&amp;gt;='$(=[OrderDate])'&amp;lt;='$(=[DueDate])'"}&amp;gt;} Order_Number)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;I've also tried:&lt;BR /&gt;count(Distinct {&amp;lt;[Shipdate]={"&amp;gt;=$(=[OrderDate])&amp;lt;=$(=[DueDate])"}&amp;gt;} Order_Number)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;and even made Num variables for the dates to make the comparison 'easier'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;count(Distinct {&amp;lt;vNumShipdate={"&amp;gt;=$(=vNumOrderDate)&amp;lt;=$(=vNumDueDate)"}&amp;gt;} Order_Number)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;And I am continually getting bad returns on it, usually giving me a positive when my If statement check shows it shouldn't be.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;I am checking this set analysis against:&lt;BR /&gt;&lt;BR /&gt;If ( [Shipdate] &amp;gt;= [OrderDate] and [Shipdate] &amp;lt;= [DueDate], 1,0) , &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;An example of my data looks like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;Order #&amp;nbsp; || Shipdate || Orderdate || DueDate || Set Analysis Count Column || If Column &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1&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; || 9/1/2018 || 8/28/2018 || 9/5/2018 ||&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; 1&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; 1&lt;/P&gt;&lt;P&gt;2&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; || 9/3/2018 || 8/20/2018 || 8/30/2018 ||&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; 1&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; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that reads clear, the second example is what I am seeing where the count with set analysis is saying that 9/3/2018 is between 8/20 and 8/30 and I am not sure what else to try.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 15:42:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618963#M63326</guid>
      <dc:creator>pindelicato</dc:creator>
      <dc:date>2021-12-22T15:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count between two dates set analysis not working</title>
      <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618966#M63327</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Try one of the below and see if it works:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;count(Distinct {&amp;lt;[Shipdate]={"&amp;gt;=[OrderDate]&amp;lt;=[DueDate]"}&amp;gt;} Order_Number)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;count(Distinct {&amp;lt;[Shipdate]={"&amp;gt;='[OrderDate]'&amp;lt;='[DueDate]'"}&amp;gt;} Order_Number)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 18:04:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618966#M63327</guid>
      <dc:creator>trdandamudi</dc:creator>
      <dc:date>2019-08-30T18:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Count between two dates set analysis not working</title>
      <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618969#M63328</link>
      <description>&lt;P&gt;sadly neither work&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 18:15:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618969#M63328</guid>
      <dc:creator>pindelicato</dc:creator>
      <dc:date>2019-08-30T18:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Count between two dates set analysis not working</title>
      <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618974#M63329</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might want to try this&lt;/P&gt;&lt;P&gt;Count({&amp;lt;Order_Number = {"([Shipdate]&amp;gt;=[OrderDate] AND [Shipdate]&amp;lt;=[DueDate])"}&amp;gt;}Distinct Order_Number)&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 19:22:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618974#M63329</guid>
      <dc:creator>chriscammers</dc:creator>
      <dc:date>2019-08-30T19:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Count between two dates set analysis not working</title>
      <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618976#M63330</link>
      <description>&lt;P&gt;I would try chris 's method if you want to do it on the front end.&lt;/P&gt;&lt;P&gt;But why not just do this on the script? Create a flag for this condition and do a simple set analysis for that flag&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If ( [Shipdate] &amp;gt;= [OrderDate] and [Shipdate] &amp;lt;= [DueDate], 1,0)&amp;nbsp; as ShippedOntimeFlag&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;expression can be&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="c-message__body"&gt;count(Distinct {&amp;lt;[&lt;SPAN&gt;ShippedOntimeFlag&lt;/SPAN&gt;]={'1'}&amp;gt;} Order_Number)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 19:36:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618976#M63330</guid>
      <dc:creator>dplr-rn</dc:creator>
      <dc:date>2019-08-30T19:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Count between two dates set analysis not working</title>
      <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618978#M63331</link>
      <description>&lt;P&gt;Lol, I was answering the question as asked, but I would prefer a solution that is calculated in the load script.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 19:41:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618978#M63331</guid>
      <dc:creator>chriscammers</dc:creator>
      <dc:date>2019-08-30T19:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count between two dates set analysis not working</title>
      <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618981#M63332</link>
      <description>&lt;P&gt;Unfortunately none of the front end solutions seem to be working, so yeah we were leaning to do it in the load script now. Was really just trying to avoid that, because at that point I could just do it in the view we are pulling from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do appreciate all the input. It is really weird that the set analysis doesn't work, it appears written correctly.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 19:48:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1618981#M63332</guid>
      <dc:creator>pindelicato</dc:creator>
      <dc:date>2019-08-30T19:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Count between two dates set analysis not working</title>
      <link>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1619264#M63333</link>
      <description>&lt;P&gt;It couldn't work in the way you tried it. In your first trials you used (adhoc) variables which have only a single value in the context of an object because the variables are evaluated at first and their results are then applied to each occurance within the object.&lt;/P&gt;&lt;P&gt;Your other trials with the "classical" set analysis won't work because a set analysis condition is like a selection in a field - means it checked only if the specified/selected values are possible or not. And this is completely independent to the (possible) values in another fields. This means a set analysis is &lt;U&gt;not&lt;/U&gt; designed to make row-based comparisons.&lt;/P&gt;&lt;P&gt;What you might trying is to implement an explicit if-loop or an implicit one, like:&lt;/P&gt;&lt;P&gt;Count({&amp;lt;Order_Number = {"&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;=&lt;/STRONG&gt;&lt;/FONT&gt;[Shipdate]&amp;gt;=[OrderDate]&amp;lt;=[DueDate]"}&amp;gt;}Distinct Order_Number)&lt;/P&gt;&lt;P&gt;It will enforce a row-level comparison but it won't not be better than using a classical if-loop.&lt;/P&gt;&lt;P&gt;But much better as this is the already suggested script-solution. It's much easier, more performant and provides far more possibilities as you could reach within the UI, for example not just using simple 1/0 flags else substracting the dates and/or assigning buckets to them and so on ... probably this would be the next questions from the users if they get a count and maybe any percentage of them ...&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 12:49:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-between-two-dates-set-analysis-not-working/m-p/1619264#M63333</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-09-02T12:49:25Z</dc:date>
    </item>
  </channel>
</rss>

