<?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 AGGR in IF Statement Does Not Generate Expected Results in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/AGGR-in-IF-Statement-Does-Not-Generate-Expected-Results/m-p/1932636#M76833</link>
    <description>&lt;P&gt;I have the following expression testing whether the measure in green is positive. If so, return it, else don't. This logic does not seem to be working, i.e., negative values are being returned. Is it because of the set analysis utilization? Because when I rewrite the green measure below WITHOUT using set analysis, then negative values are correctly excluded?&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;if(sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, TranYr = {$(=CurrYr)} &amp;gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;if(placedt_all=aggr({1} nodistinct max({1} placedt_all),acctpol), Placed))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;+ sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, Year_Placed = {$(=CurrYr)} &amp;gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;if(placedt_all=aggr({1} nodistinct max({1} placedt_all),acctpol), Adjustment)))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;gt; 0,&lt;BR /&gt;&lt;FONT color="#339966"&gt;(sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, TranYr = {$(=CurrYr)} &amp;gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;if(placedt_all=aggr({1} nodistinct max({1} placedt_all),acctpol), Placed))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;+ sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, Year_Placed = {$(=CurrYr)} &amp;gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;if(placedt_all=aggr({1} nodistinct max({1} placedt_all),acctpol), Adjustment)))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;, 0)&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2022 17:45:19 GMT</pubDate>
    <dc:creator>newuser</dc:creator>
    <dc:date>2022-05-18T17:45:19Z</dc:date>
    <item>
      <title>AGGR in IF Statement Does Not Generate Expected Results</title>
      <link>https://community.qlik.com/t5/App-Development/AGGR-in-IF-Statement-Does-Not-Generate-Expected-Results/m-p/1932636#M76833</link>
      <description>&lt;P&gt;I have the following expression testing whether the measure in green is positive. If so, return it, else don't. This logic does not seem to be working, i.e., negative values are being returned. Is it because of the set analysis utilization? Because when I rewrite the green measure below WITHOUT using set analysis, then negative values are correctly excluded?&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;if(sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, TranYr = {$(=CurrYr)} &amp;gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;if(placedt_all=aggr({1} nodistinct max({1} placedt_all),acctpol), Placed))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;+ sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, Year_Placed = {$(=CurrYr)} &amp;gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;if(placedt_all=aggr({1} nodistinct max({1} placedt_all),acctpol), Adjustment)))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;gt; 0,&lt;BR /&gt;&lt;FONT color="#339966"&gt;(sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, TranYr = {$(=CurrYr)} &amp;gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;if(placedt_all=aggr({1} nodistinct max({1} placedt_all),acctpol), Placed))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;+ sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, Year_Placed = {$(=CurrYr)} &amp;gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;if(placedt_all=aggr({1} nodistinct max({1} placedt_all),acctpol), Adjustment)))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;, 0)&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 17:45:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/AGGR-in-IF-Statement-Does-Not-Generate-Expected-Results/m-p/1932636#M76833</guid>
      <dc:creator>newuser</dc:creator>
      <dc:date>2022-05-18T17:45:19Z</dc:date>
    </item>
  </channel>
</rss>

