<?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: Comparing Result of Division Expression with float in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434505#M431071</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you flunked &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However if you do this you will be able to get the logic correct:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Round(Sum(TARGET) / Sum(FLAG),0.00001)=0.8&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Nov 2017 17:39:57 GMT</pubDate>
    <dc:creator>petter</dc:creator>
    <dc:date>2017-11-21T17:39:57Z</dc:date>
    <item>
      <title>Comparing Result of Division Expression with float</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434503#M431069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;I've uncovered what I believe is a bug when trying to compare the result of a division expression with a float. I initially uncovered it in a very complex formula with a very complex model but I've managed to finally reproduce what I believe is the core of the problem in the simplest possible model. I'm hoping if someone can explain what's going on here then I'll be able to fix the bigger problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Please find attached a very simple 25 line table with 2 columns. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;The sum of column2 is 20, the sum of column1 is 25. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;20/25 = 0.8. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;But when I say If(result=0.8,1,0) I always get a 0 when in fact it should be a 1?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If I replace the expression with the figures (e.g 20/25) then it correctly returns a 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Can someone please explain what's going on here?!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2017 16:50:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434503#M431069</guid>
      <dc:creator>christianfudge</dc:creator>
      <dc:date>2017-11-21T16:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Result of Division Expression with float</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434504#M431070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlikview.com/blogs/qlikviewdesignblog/2013/12/17/rounding-errors" title="https://community.qlikview.com/blogs/qlikviewdesignblog/2013/12/17/rounding-errors"&gt;Qlik Design Blog : Rounding Errors | Qlik Community&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2017 17:31:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434504#M431070</guid>
      <dc:creator>m_woolf</dc:creator>
      <dc:date>2017-11-21T17:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Result of Division Expression with float</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434505#M431071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you flunked &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However if you do this you will be able to get the logic correct:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Round(Sum(TARGET) / Sum(FLAG),0.00001)=0.8&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2017 17:39:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434505#M431071</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2017-11-21T17:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Result of Division Expression with float</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434506#M431072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the info, I came across something similar with dates. &lt;SPAN style="font-size: 10pt;"&gt;I only have one issue with the post you referenced...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #f5faf0;"&gt;And finally, you should &lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f5faf0;"&gt;never&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #f5faf0;"&gt; use equality as a condition when comparing floats. Use greater than or less than". &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #f5faf0;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #f5faf0;"&gt;If you change my expression to =if((Sum(TARGET)/Sum(FLAG))&amp;gt;0.8,1,0) it incorrectly returns a 1. I now know this is due to the hexadecimal representation of the result but still, the advice is incorrect isn't it? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #f5faf0;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #f5faf0;"&gt;I'm happy that I have a solution at least..... although I dread to think of the performance impact of rounding every result multiplied with 100 in all expressions dealing with decimals....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #f5faf0;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #f5faf0;"&gt;Thanks for the quick reply, very helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2017 18:01:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434506#M431072</guid>
      <dc:creator>christianfudge</dc:creator>
      <dc:date>2017-11-21T18:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Result of Division Expression with float</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434507#M431073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the addition! I much prefer using one round function rather than rounding a multiplication. Neat workaround. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2017 18:04:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-Result-of-Division-Expression-with-float/m-p/1434507#M431073</guid>
      <dc:creator>christianfudge</dc:creator>
      <dc:date>2017-11-21T18:04:26Z</dc:date>
    </item>
  </channel>
</rss>

