<?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: Formula Returns Null. Should return value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400494#M559666</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;would it be&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;alt(0,&lt;/STRONG&gt;(sum({&amp;lt;trantype={'MFG-CUS'}&amp;gt;} if(jobclosed='Open',0, tranqty))&lt;/SPAN&gt; / (sum({&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;}if(jobclosed='Open',0, tranqty ))) &lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;or &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;alt(&lt;/STRONG&gt;(sum({&amp;lt;trantype={'MFG-CUS'}&amp;gt;} if(jobclosed='Open',0, tranqty))&lt;/SPAN&gt; / (sum({&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;}if(jobclosed='Open',0, tranqty ))),0 &lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Apr 2013 13:45:27 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-04-25T13:45:27Z</dc:date>
    <item>
      <title>Formula Returns Null. Should return value</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400492#M559664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having issues with the following formula. It seems to not like part of it&amp;nbsp; and returns null which returns null for the entire formula. In the case of &lt;STRONG style="color: #0000ff;"&gt;{&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;} &lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;there are actualy no records to return which I am guessing is why I am getting a null result instead of a 0 result. Is there anyway to tell that section that if no records are found then to return a 0?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;sum({&amp;lt;trantype={'MFG-CUS','MFG-VAR'}&amp;gt;} tranqty *( lbrunitcost))&amp;nbsp; //Returns 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;((//[Labor to Date] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;jobclosed={'Closed'}&amp;gt;}(0 + (laborhrs * laborrate)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;+&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;trantype={'*-MTL','*-DMR','WIP-MFG'},jobclosed={'Closed'}&amp;gt;}(0 +&amp;nbsp; if(wildmatch(trantype,'*-DMR'),(tranqty * lbrunitcost * (-1)),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;if(wildmatch(trantype,'ADJ-*'),lbrunitcost, tranqty * lbrunitcost))))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;- &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;//[Inventory Labor]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;trantype={'*-STK','MFG-WIP'},jobclosed={'Closed'}&amp;gt;}(0 + tranqty * lbrunitcost))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;trantype={'MFG-CUS','MFG-VAR'},jobclosed={'Closed'}&amp;gt;} (0 + tranqty *( lbrunitcost )))) // value returned 1,036.16&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff;"&gt;*(sum({&amp;lt;trantype={'MFG-CUS'}&amp;gt;}if(jobclosed='Open',0, tranqty)) /&amp;nbsp;&amp;nbsp; (sum({&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;}if(jobclosed='Open',0,&amp;nbsp; tranqty ))))) //This returns null causing the entire section to be null. Actual value returned is 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;((&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;(//[Labor to Date] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;(sum({&amp;lt;jobclosed={'Closed'}&amp;gt;}(0 + (laborhrs * laborrate)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;+&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;sum({&amp;lt;trantype={'*-MTL','*-DMR','WIP-MFG'},jobclosed={'Closed'}&amp;gt;}(0 +&amp;nbsp; if(wildmatch(trantype,'*-DMR'),(tranqty * lbrunitcost * (-1)),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;if(wildmatch(trantype,'ADJ-*'),lbrunitcost, tranqty * lbrunitcost))))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;- &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;//[Inventory Labor]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;sum({&amp;lt;trantype={'*-STK','MFG-WIP'},jobclosed={'Closed'}&amp;gt;}(0 + tranqty * lbrunitcost))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;sum({&amp;lt;trantype={'MFG-CUS','MFG-VAR'},jobclosed={'Closed'}&amp;gt;}(0 +&amp;nbsp; tranqty *( lbrunitcost ))))) // This returns 1,036.16&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;((//[Labor to Date] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;jobclosed={'Closed'}&amp;gt;}(0 + (laborhrs * laborrate)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;+&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;trantype={'*-MTL','*-DMR','WIP-MFG'},jobclosed={'Closed'}&amp;gt;}(0 +&amp;nbsp; if(wildmatch(trantype,'*-DMR'),(tranqty * lbrunitcost * (-1)),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;if(wildmatch(trantype,'ADJ-*'),lbrunitcost, tranqty * lbrunitcost))))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;- &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;//[Inventory Labor]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;trantype={'*-STK','MFG-WIP'},jobclosed={'Closed'}&amp;gt;}(0 + tranqty * lbrunitcost))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;trantype={'MFG-CUS','MFG-VAR'},jobclosed={'Closed'}&amp;gt;}(0 +&amp;nbsp; tranqty *( lbrunitcost )))) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;// value returned 1,036.16&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff;"&gt;*(sum({&amp;lt;trantype={'MFG-CUS'}&amp;gt;} if(jobclosed='Open',0, tranqty))/ (sum({&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;}if(jobclosed='Open',0, tranqty ))))) //Returns null should return 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final Value returned should be 1,036.16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(0 + (1,036.16 * 0) + (1,036.16 - (1,036.16 * 0 )))= 1,036.16&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 13:10:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400492#M559664</guid>
      <dc:creator />
      <dc:date>2013-04-25T13:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Returns Null. Should return value</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400493#M559665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #000000;"&gt;*(sum({&amp;lt;trantype={'MFG-CUS'}&amp;gt;} if(jobclosed='Open',0, tranqty)) &lt;STRONG&gt;/ (sum({&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;}if(jobclosed='Open',0, tranqty )) &lt;/STRONG&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #000000;"&gt;If the bold part returns 0 you're dividing by zero. And that is frowned upon in this universe. You could try to wrap an alt() around the entire division...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;* &lt;STRONG&gt;alt(&lt;/STRONG&gt;(sum({&amp;lt;trantype={'MFG-CUS'}&amp;gt;} if(jobclosed='Open',0, tranqty))&lt;/SPAN&gt; / (sum({&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;}if(jobclosed='Open',0, tranqty )))&lt;STRONG&gt;,0&lt;/STRONG&gt; &lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt; ))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #000000;"&gt;... but I'm not sure that would bypass the divide-by-zero issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #000000;"&gt;&lt;EM&gt;edit: fixed the alt &lt;/EM&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 13:35:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400493#M559665</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-04-25T13:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Returns Null. Should return value</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400494#M559666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;would it be&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;alt(0,&lt;/STRONG&gt;(sum({&amp;lt;trantype={'MFG-CUS'}&amp;gt;} if(jobclosed='Open',0, tranqty))&lt;/SPAN&gt; / (sum({&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;}if(jobclosed='Open',0, tranqty ))) &lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;or &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;alt(&lt;/STRONG&gt;(sum({&amp;lt;trantype={'MFG-CUS'}&amp;gt;} if(jobclosed='Open',0, tranqty))&lt;/SPAN&gt; / (sum({&amp;lt;trantype={'MFG-CUS','MFG-STK'}&amp;gt;}if(jobclosed='Open',0, tranqty ))),0 &lt;SPAN style="color: #000000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 13:45:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400494#M559666</guid>
      <dc:creator />
      <dc:date>2013-04-25T13:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Returns Null. Should return value</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400495#M559667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops. It should be the latter. Good catch.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 13:58:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400495#M559667</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-04-25T13:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Returns Null. Should return value</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400496#M559668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alright, thank you very much for your help. So far this seems to be working correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 13:59:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-Returns-Null-Should-return-value/m-p/400496#M559668</guid>
      <dc:creator />
      <dc:date>2013-04-25T13:59:56Z</dc:date>
    </item>
  </channel>
</rss>

