<?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 count(if ) in script returns incorrect value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224937#M77299</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I managed to solve this, and decided to share my solution, I attached the Project files to this topic.&lt;/P&gt;&lt;P&gt;What is does it count days from start till end while it deducts weekend and holidays based on country.&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Michiel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Feb 2011 12:17:56 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-02-24T12:17:56Z</dc:date>
    <item>
      <title>count(if ) in script returns incorrect value</title>
      <link>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224933#M77295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I modified an existing web script to calculate NetworkDays, All parts of this script seem to to work as my below screenshot can show.&lt;/P&gt;&lt;P&gt;Date = autogenerate date range based on below "Date1" and "Date2"&lt;BR /&gt;Date1 = start date&lt;BR /&gt;Date2 = end date&lt;BR /&gt;IHD = isHoliday&lt;BR /&gt;IWD = IsWorkDay&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-3630_sourceID:3630" /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;After this I put below formula in script to count the real working days.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//NetoWork:&lt;BR /&gt;//Inner join (DatesRanges)&lt;BR /&gt;//load&lt;BR /&gt;// Date1,&lt;BR /&gt;// Date2,&lt;BR /&gt;// count(distinct if(Date&amp;gt;=Date1 and Date&amp;lt;=Date2 and IWD and IHD&amp;lt;&amp;gt;0,Date)) as NetoWork1&lt;BR /&gt;//resident NetoWork1&lt;BR /&gt;// where 1=1&lt;BR /&gt; // and isnull(Date1)=0&lt;BR /&gt;// and isnull(Date2)=0&lt;BR /&gt;//group by Date1,Date2;&lt;BR /&gt;//drop table NetoWork1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The problem is that this count return the days as 7 and it does not deduct the holidays, because then it result would be 5.&lt;BR /&gt;Can anybody please let me know where the problem my be, it's slowly driving me crazy.&lt;/P&gt;&lt;P&gt;The complete modified NetoWorkday script is attached, if you need more details please ask....&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Michiel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Feb 2011 11:16:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224933#M77295</guid>
      <dc:creator />
      <dc:date>2011-02-22T11:16:25Z</dc:date>
    </item>
    <item>
      <title>count(if ) in script returns incorrect value</title>
      <link>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224934#M77296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would be good to have an example to check on the data.&lt;BR /&gt;The DISTINCT-parameter does not make much sense with the above data, only if you have duplicates for Date.&lt;BR /&gt;Would also implicitely include the condition for the IWD.&lt;BR /&gt;When working with 64bit-systems the ISNULL-function should be replaced with LEN(TRIM(...))=0 (not relevant for this problem).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;EM&gt;count(if(Date&amp;gt;=Date1 and Date&amp;lt;=Date2 and IWD=1 and IHD&amp;lt;&amp;gt;0,Date)) as NetoWork1&lt;/EM&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;HTH&lt;BR /&gt;Peter&lt;EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Feb 2011 12:19:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224934#M77296</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2011-02-22T12:19:25Z</dc:date>
    </item>
    <item>
      <title>count(if ) in script returns incorrect value</title>
      <link>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224935#M77297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;All comments are very userfull, since I run the script from 64bit server.&lt;/P&gt;&lt;P&gt;Trying all suggestions now and post test results here when done.&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;Michiel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Feb 2011 12:30:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224935#M77297</guid>
      <dc:creator />
      <dc:date>2011-02-22T12:30:36Z</dc:date>
    </item>
    <item>
      <title>count(if ) in script returns incorrect value</title>
      <link>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224936#M77298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems I was totaly off, the screenshot of the table I posted in my first post does not represent all records in this table. Therefore a count on it's contents would almost always return more TRUE cases than excepted based on the information I provided.&lt;/P&gt;&lt;P&gt;The real information in the table is for example:&lt;/P&gt;&lt;P&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/4274.Untitled.jpg"&gt;&lt;/A&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/0550.Untitled.jpg"&gt;&lt;IMG alt="" border="0" src="http://community.qlik.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Discussions.Components.Files/11/0550.Untitled.jpg" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;my count statement in script is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;(&lt;B&gt;distinct&lt;/B&gt; if(Date&amp;gt;=Date1 &lt;B&gt;and&lt;/B&gt; Date&amp;lt;=Date2 &lt;B&gt;and&lt;/B&gt; IWD=1 &lt;B&gt;and&lt;/B&gt; RMACountry = CountryCode,Date)) &lt;B&gt;as&lt;/B&gt; NetoWork1; &lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;In case of AT country, where working day is false (0), it will also find the NLor other country record(s) and count it as true.&lt;/P&gt;&lt;P&gt;My question is how to separate on country level, I will also attach the whole project now.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Michiel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Feb 2011 13:52:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224936#M77298</guid>
      <dc:creator />
      <dc:date>2011-02-23T13:52:05Z</dc:date>
    </item>
    <item>
      <title>count(if ) in script returns incorrect value</title>
      <link>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224937#M77299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I managed to solve this, and decided to share my solution, I attached the Project files to this topic.&lt;/P&gt;&lt;P&gt;What is does it count days from start till end while it deducts weekend and holidays based on country.&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Michiel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Feb 2011 12:17:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-if-in-script-returns-incorrect-value/m-p/224937#M77299</guid>
      <dc:creator />
      <dc:date>2011-02-24T12:17:56Z</dc:date>
    </item>
  </channel>
</rss>

