<?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 all positive values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480170#M482478</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression is a bit complicated for me to try and reproduce, but just breaking it down it reads:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count distinct [Instr ID] if (complicated sum minus 1) is less than 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Removing the (complicated sum) expression and just plugging in some positive and negative values did return a result; however as the if statement is testing against less than zero right at the end, it is just counts those [Instr ID] with -ve values. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Does that help? If I've misunderstood, then perhaps you can provide some results for:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;exp&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;({&amp;lt;&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;= {&lt;SPAN style="color: #800000;"&gt;"&amp;gt;=$(=StartDate)&amp;lt;=$(=EndDate)"&lt;/SPAN&gt;}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;total&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;log&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;EoP_PX&lt;/SPAN&gt;)/&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;BoP_PX&lt;/SPAN&gt;)),&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Azam&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Aug 2013 09:36:52 GMT</pubDate>
    <dc:creator>a_mullick</dc:creator>
    <dc:date>2013-08-09T09:36:52Z</dc:date>
    <item>
      <title>Count all positive values</title>
      <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480169#M482477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I &lt;SPAN style="font-size: 10pt;"&gt;have a problem which I can't solve: I have a set of instruments for which I calculate the performance over a period of time. In a next step, I would like to count all instruments withh a positive performance. When I enter the following formula: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;count&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;distinct&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;if&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;exp&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;({&amp;lt;&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;= {&lt;SPAN style="color: #800000;"&gt;"&amp;gt;=$(=StartDate)&amp;lt;=$(=EndDate)"&lt;/SPAN&gt;}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;total&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;log&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;EoP_PX&lt;/SPAN&gt;)/&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;BoP_PX&lt;/SPAN&gt;)),&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;)))-1&amp;lt;0,&lt;SPAN style="color: #800000;"&gt;[Instr ID]&lt;/SPAN&gt;)))&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;it doesn't limit on positive values only but gives me the overall number of instruments. I can't figure out what is wrong here. Can someone please help?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thank you very much!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Laila&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 06:49:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480169#M482477</guid>
      <dc:creator />
      <dc:date>2013-08-09T06:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count all positive values</title>
      <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480170#M482478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression is a bit complicated for me to try and reproduce, but just breaking it down it reads:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count distinct [Instr ID] if (complicated sum minus 1) is less than 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Removing the (complicated sum) expression and just plugging in some positive and negative values did return a result; however as the if statement is testing against less than zero right at the end, it is just counts those [Instr ID] with -ve values. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Does that help? If I've misunderstood, then perhaps you can provide some results for:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;exp&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;({&amp;lt;&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;= {&lt;SPAN style="color: #800000;"&gt;"&amp;gt;=$(=StartDate)&amp;lt;=$(=EndDate)"&lt;/SPAN&gt;}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;total&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;log&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;EoP_PX&lt;/SPAN&gt;)/&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;BoP_PX&lt;/SPAN&gt;)),&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Azam&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 09:36:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480170#M482478</guid>
      <dc:creator>a_mullick</dc:creator>
      <dc:date>2013-08-09T09:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Count all positive values</title>
      <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480171#M482479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Azam, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you very much for the reply. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You understand completely right. What the formula does is that it calculates the performance of instruments between a start and end date (which can be set by the user), by adding up the logarithmic daily performances up to that day with each other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the impression that the 'total aggr' might be the problem, but I just can't figure it out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kind regards, &lt;/P&gt;&lt;P&gt;Laila&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 11:04:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480171#M482479</guid>
      <dc:creator />
      <dc:date>2013-08-09T11:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Count all positive values</title>
      <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480172#M482480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are StartDate and EndDate variables or fields?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If they are variables :&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;count&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;distinct&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;if&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;exp&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;({&amp;lt;&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;= {&lt;SPAN style="color: #800000;"&gt;"&amp;gt;=$(StartDate)&amp;lt;=$(EndDate)"&lt;/SPAN&gt;}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;total&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;log&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;EoP_PX&lt;/SPAN&gt;)/&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;BoP_PX&lt;/SPAN&gt;)),&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;)))-1&amp;lt;0,&lt;SPAN style="color: #800000;"&gt;[Instr ID]&lt;/SPAN&gt;)))&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else if they are fields try adding min and max functions to the StartDate and EndDate.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;count&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;distinct&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;if&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;exp&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;({&amp;lt;&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;= {&lt;SPAN style="color: #800000;"&gt;"&amp;gt;=$(=min(StartDate))&amp;lt;=$(=max(EndDate))"&lt;/SPAN&gt;}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;total&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;log&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;EoP_PX&lt;/SPAN&gt;)/&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;BoP_PX&lt;/SPAN&gt;)),&lt;SPAN style="color: #800000;"&gt;Date&lt;/SPAN&gt;)))-1&amp;lt;0,&lt;SPAN style="color: #800000;"&gt;[Instr ID]&lt;/SPAN&gt;)))&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will be helpful if you could attach the app with sample data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;MultiView&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 12:14:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480172#M482480</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-09T12:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Count all positive values</title>
      <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480173#M482481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've had to simplify things a bit, but I think the text box has the expression that you need (although you need to re-do the set analysis for dates and add your log expression etc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the main thing is that you need to aggregate over 2 dimensions: the date and the instrument ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know how you get on,&lt;/P&gt;&lt;P&gt;Azam&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: a.mullick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 12:58:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480173#M482481</guid>
      <dc:creator>a_mullick</dc:creator>
      <dc:date>2013-08-09T12:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Count all positive values</title>
      <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480174#M482482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;dear both, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried your solutions, but it is still not working. Mullviews solution doesn't filter for some reasons and when I apply Azams solution it gives me an error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess it has something to do with the calculation of the performance. the dates are variables. I attached a simplified app, maybe this will clarify it a bit. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, thank you very much for your help so far. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 14:01:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480174#M482482</guid>
      <dc:creator />
      <dc:date>2013-08-09T14:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count all positive values</title>
      <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480175#M482483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, this is my final try, otherwise, I'll just be more of a hindrance than a help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've changed the formulae around a bit, so hopefully I haven't totally messed up your expression!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Azam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 15:29:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480175#M482483</guid>
      <dc:creator>a_mullick</dc:creator>
      <dc:date>2013-08-09T15:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Count all positive values</title>
      <link>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480176#M482484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are the man!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That was exactly it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for the help, this is awesome!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, &lt;/P&gt;&lt;P&gt;Laila&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 15:48:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-all-positive-values/m-p/480176#M482484</guid>
      <dc:creator />
      <dc:date>2013-08-09T15:48:06Z</dc:date>
    </item>
  </channel>
</rss>

