<?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: How to calculate this correct in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-calculate-this-correct/m-p/2331719#M100674</link>
    <description>Hi&amp;nbsp;
&lt;BR /&gt;Try this:
&lt;BR /&gt;(row1.
&lt;FONT size="2"&gt;&lt;FONT face="Verdana," helvetica=""&gt;SalesPrice&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;.multiply(new java.math.BigDecimal(row1.
&lt;FONT size="2"&gt;&lt;FONT face="Verdana," helvetica=""&gt;Amount&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;.toString())&amp;nbsp;)).subtract(row1.
&lt;FONT size="2"&gt;&lt;FONT face="Verdana," helvetica=""&gt;BuyinPrice&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;.multiply(new java.math.BigDecimal(row1.
&lt;FONT size="2"&gt;&lt;FONT face="Verdana," helvetica=""&gt;Amount&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;.toString())&amp;nbsp;))&amp;nbsp;
&lt;BR /&gt;
&lt;BR /&gt;What are your expected result after converting the calculation result to an int value? For example, assuming the above calculation result is 14.99999 with BigDecimal type, what value do you expect to have for int type.&amp;nbsp;
&lt;BR /&gt;14
&lt;BR /&gt;or&amp;nbsp;
&lt;BR /&gt;15 with rounding.&amp;nbsp;</description>
    <pubDate>Sun, 24 Jan 2016 05:30:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-01-24T05:30:16Z</dc:date>
    <item>
      <title>How to calculate this correct</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-calculate-this-correct/m-p/2331718#M100673</link>
      <description>&lt;P&gt;Hello there&lt;BR /&gt;So i have a problem.&lt;BR /&gt;In my mssql salestable i have 3 columns. &lt;BR /&gt;BuyinPrice (Bigdecimal)&lt;BR /&gt;SalesPrice (Bigdecimal)&lt;BR /&gt;Amount (float)&lt;BR /&gt;&lt;BR /&gt;I need to make this calculation to see how much i earn on each sale. And write that into my target db in a INT column.&lt;BR /&gt;SalesPrice*Amount-BuyinPrice*Amount = WINNING (int)&lt;BR /&gt;&lt;BR /&gt;I made mistakes before when i calculated that rounded things up so i got the wrong value in the end. &lt;BR /&gt;Can someone help me with the code i have to use in tmap in my variable that counts this.&lt;BR /&gt;&lt;BR /&gt;Is this Correct? &lt;BR /&gt;(row11.SalesPrice.multiply(BigDecimal.valueOf(row11.Amount))).subtract(row11.BuyinPrice.multiply(BigDecimal.valueOf(row11.Amount)))&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;and then (int)Var.fromabove.doubleValue() &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 14:04:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-calculate-this-correct/m-p/2331718#M100673</guid>
      <dc:creator>jensej</dc:creator>
      <dc:date>2016-01-19T14:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate this correct</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-calculate-this-correct/m-p/2331719#M100674</link>
      <description>Hi&amp;nbsp;
&lt;BR /&gt;Try this:
&lt;BR /&gt;(row1.
&lt;FONT size="2"&gt;&lt;FONT face="Verdana," helvetica=""&gt;SalesPrice&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;.multiply(new java.math.BigDecimal(row1.
&lt;FONT size="2"&gt;&lt;FONT face="Verdana," helvetica=""&gt;Amount&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;.toString())&amp;nbsp;)).subtract(row1.
&lt;FONT size="2"&gt;&lt;FONT face="Verdana," helvetica=""&gt;BuyinPrice&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;.multiply(new java.math.BigDecimal(row1.
&lt;FONT size="2"&gt;&lt;FONT face="Verdana," helvetica=""&gt;Amount&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;.toString())&amp;nbsp;))&amp;nbsp;
&lt;BR /&gt;
&lt;BR /&gt;What are your expected result after converting the calculation result to an int value? For example, assuming the above calculation result is 14.99999 with BigDecimal type, what value do you expect to have for int type.&amp;nbsp;
&lt;BR /&gt;14
&lt;BR /&gt;or&amp;nbsp;
&lt;BR /&gt;15 with rounding.&amp;nbsp;</description>
      <pubDate>Sun, 24 Jan 2016 05:30:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-calculate-this-correct/m-p/2331719#M100674</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-24T05:30:16Z</dc:date>
    </item>
  </channel>
</rss>

