<?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: Assistance with folmula in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525094#M106973</link>
    <description>&lt;P&gt;You can still add the formula, there was only one parenthesis missing in the entire red block&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT size="5" color="#800080"&gt;(&lt;/FONT&gt;(sum(if(TCODE='IN',AMOUNT)) - Sum(if(TCODE='CN',AMOUNT)) - Sum(total if(TCODE='IN', AVRGCOST)) - Sum(if(TCODE='CN',AVRGCOST))&lt;FONT size="5" color="#800080"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;/&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#99CC00"&gt;(Sum(total if(TCODE='IN', AVRGCOST)) - Sum(if(TCODE='CN',AVRGCOST)))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I suggest replacing the IFs with Set Analysis for better performance as follows below (other set optimizations are still possible)&lt;/P&gt;&lt;LI-CODE lang="php"&gt;(
      Sum({&amp;lt;TCODE={IN}&amp;gt;} AMOUNT) 
    - Sum({&amp;lt;TCODE={CN}&amp;gt;} AMOUNT + AVRGCOST) 
    - Sum({&amp;lt;TCODE={IN}&amp;gt;} Total AVRGCOST)     
) 
/ 
(
      Sum({&amp;lt;TCODE={IN}&amp;gt;} Total AVRGCOST) 
    - Sum({&amp;lt;TCODE={IN}&amp;gt;} AVRGCOST)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jul 2025 14:24:37 GMT</pubDate>
    <dc:creator>adilio_silva</dc:creator>
    <dc:date>2025-07-23T14:24:37Z</dc:date>
    <item>
      <title>Assistance with folmula</title>
      <link>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525036#M106962</link>
      <description>&lt;P&gt;&lt;FONT color="#FF0000"&gt;sum(if(TCODE='IN',AMOUNT)) - Sum(if(TCODE='CN',AMOUNT)) - Sum(total if(TCODE='IN', AVRGCOST)) - Sum(if(TCODE='CN',AVRGCOST))&lt;/FONT&gt; / &lt;FONT color="#99CC00"&gt;(Sum(total if(TCODE='IN', AVRGCOST)) - Sum(if(TCODE='CN',AVRGCOST)))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;1st Red sum = 2695334&lt;/P&gt;&lt;P&gt;2nd Green Sum = 499956&lt;/P&gt;&lt;P&gt;So 2695334 / 499956 should = 0.53 or 53%&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 07:34:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525036#M106962</guid>
      <dc:creator>GregRyder</dc:creator>
      <dc:date>2025-07-23T07:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with folmula</title>
      <link>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525039#M106963</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Dont worry, worked it out, I created master items of the two sums and then did the formula I wanted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 07:45:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525039#M106963</guid>
      <dc:creator>GregRyder</dc:creator>
      <dc:date>2025-07-23T07:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with folmula</title>
      <link>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525094#M106973</link>
      <description>&lt;P&gt;You can still add the formula, there was only one parenthesis missing in the entire red block&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT size="5" color="#800080"&gt;(&lt;/FONT&gt;(sum(if(TCODE='IN',AMOUNT)) - Sum(if(TCODE='CN',AMOUNT)) - Sum(total if(TCODE='IN', AVRGCOST)) - Sum(if(TCODE='CN',AVRGCOST))&lt;FONT size="5" color="#800080"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;/&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#99CC00"&gt;(Sum(total if(TCODE='IN', AVRGCOST)) - Sum(if(TCODE='CN',AVRGCOST)))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I suggest replacing the IFs with Set Analysis for better performance as follows below (other set optimizations are still possible)&lt;/P&gt;&lt;LI-CODE lang="php"&gt;(
      Sum({&amp;lt;TCODE={IN}&amp;gt;} AMOUNT) 
    - Sum({&amp;lt;TCODE={CN}&amp;gt;} AMOUNT + AVRGCOST) 
    - Sum({&amp;lt;TCODE={IN}&amp;gt;} Total AVRGCOST)     
) 
/ 
(
      Sum({&amp;lt;TCODE={IN}&amp;gt;} Total AVRGCOST) 
    - Sum({&amp;lt;TCODE={IN}&amp;gt;} AVRGCOST)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 14:24:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525094#M106973</guid>
      <dc:creator>adilio_silva</dc:creator>
      <dc:date>2025-07-23T14:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with folmula</title>
      <link>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525109#M106977</link>
      <description>&lt;P&gt;for better performance of the dashboard you can use the Set analysis instead of the IF statement.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 17:34:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525109#M106977</guid>
      <dc:creator>anat</dc:creator>
      <dc:date>2025-07-23T17:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with folmula</title>
      <link>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525146#M106982</link>
      <description>&lt;P data-start="163" data-end="386"&gt;I ran into similar confusion before when working with nested sums and averages like this. One thing to double-check is the order of operations—especially with how parentheses are used around the numerator and denominator.&lt;/P&gt;
&lt;P data-start="393" data-end="678"&gt;Sometimes I test these calculations outside Qlik to verify if the math works out as expected. For quick checks, I use this basic calculator tool: &lt;A href="https://lacalculadaradealicia.es/" target="_blank" rel="noopener" data-start="539" data-end="609"&gt;lacalculadaradealicia.es&lt;/A&gt; — it helps me isolate and validate parts of the formula step by step.&lt;/P&gt;
&lt;P data-start="685" data-end="752"&gt;You might want to wrap your denominator in parentheses like this:&lt;BR /&gt;Sum(if(TCODE='IN',AMOUNT)) &lt;BR /&gt;- Sum(if(TCODE='CN',AMOUNT)) &lt;BR /&gt;- (Sum(total if(TCODE='IN', AVRGCOST)) - Sum(if(TCODE='CN',AVRGCOST))) &lt;BR /&gt;/ (Sum(total if(TCODE='IN', AVRGCOST)) - Sum(if(TCODE='CN',AVRGCOST))) &lt;BR /&gt;That way, you're not dividing before completing the subtraction. Let me know if that helps.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2025 05:48:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Assistance-with-folmula/m-p/2525146#M106982</guid>
      <dc:creator>SofiaJone</dc:creator>
      <dc:date>2025-07-24T05:48:08Z</dc:date>
    </item>
  </channel>
</rss>

