<?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: sum over if statement with integraded set analysis function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397066#M423978</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create one inline table like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;Dim&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And use dimension like&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Pick(Dim, contract_no, 'TOTAL')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expression is&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Pick(Dim,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=0,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1), &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1) &amp;gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term),&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;}&lt;/SPAN&gt;contract_payment_perc),0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)-&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} contract_term)&lt;/SPAN&gt;,&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;))),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=0,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'first'}&amp;gt;} TOTAL contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} TOTAL contract_term)&lt;/SPAN&gt;,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} TOTAL contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} TOTAL contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1), &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} TOTAL contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1) &amp;gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} TOTAL contract_term),&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt; contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;&lt;/SPAN&gt;contract_payment_perc),0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)-&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;contract_term)&lt;/SPAN&gt;,&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Nov 2017 12:52:30 GMT</pubDate>
    <dc:creator>Anil_Babu_Samineni</dc:creator>
    <dc:date>2017-11-15T12:52:30Z</dc:date>
    <item>
      <title>sum over if statement with integrated set analysis function</title>
      <link>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397065#M423977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my database&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;contract_number&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;contract_start_date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;contract_end_date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;contract_term&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;contract_term_type&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;contract_payment_perc&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;100001&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.01.2012&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31.12.2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;36&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;first&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3,11%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.01.2015&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;30.06.2015&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;second&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.07.2016&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31.12.2016&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;third&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1,5%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100002&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.01.2013&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31.12.2016&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;48&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;first&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2,66%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100002&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.01.2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31.12.2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;second&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1,5%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100002&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.01.2018&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;30.06.2018&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;third&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0,5%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100003&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.01.2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31.12.2019&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;36&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;first&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3,05%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100003&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.01.2020&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;30.06.2020&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;second&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1,9%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100003&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01.07.2020&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31.12.2020&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;third&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1,45%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a variable v_target_date to calculate my present value depended on the variable v_target_date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created in the script a new field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lpm_history:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(contract_term_type='first', Monthstart(AddMonths(contract_start_date, contract_term)+1)) as contract_begin_ext_simulation;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expression :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=0,&lt;/P&gt;&lt;P&gt;(PV(0.01/12, &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1),&lt;/P&gt;&lt;P&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=&lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;PV(0.01/12, &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1), &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1,&lt;/P&gt;&lt;P&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1) &amp;gt; &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;PV(0.01/12, &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P&gt;PV(0.01/12, &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;}&lt;/SPAN&gt; contract_payment_perc),0,1)*-1+&lt;/P&gt;&lt;P&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)-&lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} contract_term)&lt;/SPAN&gt;,&lt;SPAN style="color: #ff0000;"&gt; sum({&amp;lt;contract_term_type={'third'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1&lt;/P&gt;&lt;P&gt;)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i marked the set analysis in red&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what QV returns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="183368" alt="test.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/183368_test.PNG" style="height: 188px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything is right so far&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'd like to do in the next step is to take the sum of all&lt;/P&gt;&lt;P&gt;-&amp;gt; 210,14%+164,65%+119,59% = 494,38% and return the result in a textbox&lt;/P&gt;&lt;P&gt;unfortunetely I can't just add a sum() in front of my expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any possibility to do that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 12:47:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397065#M423977</guid>
      <dc:creator>thanhphongle</dc:creator>
      <dc:date>2017-11-15T12:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: sum over if statement with integraded set analysis function</title>
      <link>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397066#M423978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create one inline table like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;Dim&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And use dimension like&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Pick(Dim, contract_no, 'TOTAL')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expression is&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Pick(Dim,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=0,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1), &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1) &amp;gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term),&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;}&lt;/SPAN&gt;contract_payment_perc),0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)-&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} contract_term)&lt;/SPAN&gt;,&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;))),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=0,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'first'}&amp;gt;} TOTAL contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} TOTAL contract_term)&lt;/SPAN&gt;,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} TOTAL contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} TOTAL contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1), &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} TOTAL contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1) &amp;gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} TOTAL contract_term),&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'first'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt; contract_term)&lt;/SPAN&gt;, &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'second'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;&lt;/SPAN&gt;contract_payment_perc),0,1)*-1+&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)-&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;contract_term)&lt;/SPAN&gt;,&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;sum({&amp;lt;contract_term_type={'third'}&amp;gt;} &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TOTAL &lt;/SPAN&gt;contract_payment_perc)&lt;/SPAN&gt;,0,1)*-1&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 12:52:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397066#M423978</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-11-15T12:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: sum over if statement with integraded set analysis function</title>
      <link>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397067#M423979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Anil , thanks for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just follow ur instructions. But QV returns me this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="test2.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/183369_test2.PNG" style="height: 216px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the result should be:&lt;/P&gt;&lt;P&gt;210,14%+164,65%+119,59% = 494,38% and return the result in a textbox&lt;/P&gt;&lt;P&gt;and could u maybe explain me what the function dim() is exactly doing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 13:04:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397067#M423979</guid>
      <dc:creator>thanhphongle</dc:creator>
      <dc:date>2017-11-15T13:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: sum over if statement with integraded set analysis function</title>
      <link>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397068#M423980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you say, You expression works. That means The above may work as expected. And, I just throw a stone but no luck for you. Will you able to provide sample?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try with your expression like&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Pick(Dim, [Your Expression], 1000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And show the image / it would be great if you share sample file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 13:07:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397068#M423980</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-11-15T13:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: sum over if statement with integraded set analysis function</title>
      <link>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397069#M423981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you try this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep the dimension same as Anil mentioned, but change your expression to this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #ff0000;"&gt;Sum(Aggr(&lt;/SPAN&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=0,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(PV(0.01/12, sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc),0,1)*-1),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;lt;=sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PV(0.01/12, sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc),0,1)*-1+&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1), sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_payment_perc),0,1)*-1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)&amp;gt;0 AND&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1) &amp;gt; sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PV(0.01/12, sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'first'}&amp;gt;} contract_payment_perc),0,1)*-1+&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PV(0.01/12, sum({&amp;lt;contract_term_type={'second'}&amp;gt;} contract_term), sum({&amp;lt;contract_term_type={'second'}&amp;gt;}contract_payment_perc),0,1)*-1+&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PV(0.01/12, ((year(v_target_date)-year(contract_begin_ext_simulation))*12+(month(v_target_date)-month(contract_begin_ext_simulation))+1)-sum({&amp;lt;contract_term_type={'third'}&amp;gt;} contract_term),sum({&amp;lt;contract_term_type={'third'}&amp;gt;} contract_payment_perc),0,1)*-1&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;)))&lt;SPAN style="color: #ff0000;"&gt;, Contract_Number))&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 13:07:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397069#M423981</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-15T13:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: sum over if statement with integraded set analysis function</title>
      <link>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397070#M423982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;It works with the sum(aggr(x,contract_number) function. Now I dont know who I should give the right answer measured by the engagement. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 13:57:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397070#M423982</guid>
      <dc:creator>thanhphongle</dc:creator>
      <dc:date>2017-11-15T13:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: sum over if statement with integraded set analysis function</title>
      <link>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397071#M423983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunny answer should be right this case&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 13:58:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-over-if-statement-with-integrated-set-analysis-function/m-p/1397071#M423983</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-11-15T13:58:51Z</dc:date>
    </item>
  </channel>
</rss>

