<?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 DAX bug or something fundamental I don't get? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1381460#M25247</link>
    <description>&lt;P&gt;Lately I've been running into the weirdest errors. Here is one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have a simple table with 3 columns (Date, Open, Close) and create a measure to calculate the difference between the Open and Closed (the range):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Range = MAX ( 'Table'[Close] ) - MAX ( 'Table'[Open] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Now I want to count the number of occurrence of each range.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;First I create a calculated table with the top and bottom range:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gen1 = GENERATESERIES ( -10, 10, 1 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I count the rows for each value:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count1 = 
    CALCULATE ( 
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', [Range] = MAX ( Gen1[Value] ) ) 
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results are as expected, nothing seems out of the ordinary (Gen table 1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now here is the most mind boggling behaviour I found:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I slightly modify my calculated table by incrementing by 0.5 instead of 1:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gen2 = GENERATESERIES ( -10, 10, 0.5 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This returns the exact same results as expected (Gen table 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally I change my table again, this time incrementing by 0.1:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gen3 = GENERATESERIES ( -10, 10, 0.1 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this time the whole calculation breaks (Gen table 3).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understand why this happens. Either I discovered a bug in DAX or there is something fundamental that I don't understand about DAX as by logic this should not be happening.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: Here is the file for reference:&amp;nbsp;&lt;A href="https://www.dropbox.com/s/vhgoxdu95899u99/PowerBI%20Mistery.pbix?dl=0" target="_blank" rel="noopener"&gt;PowerBI Mistery.pbix&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 19 Sep 2020 08:36:38 GMT</pubDate>
    <dc:creator>zaza</dc:creator>
    <dc:date>2020-09-19T08:36:38Z</dc:date>
    <item>
      <title>DAX bug or something fundamental I don't get?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1381460#M25247</link>
      <description>&lt;P&gt;Lately I've been running into the weirdest errors. Here is one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have a simple table with 3 columns (Date, Open, Close) and create a measure to calculate the difference between the Open and Closed (the range):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Range = MAX ( 'Table'[Close] ) - MAX ( 'Table'[Open] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Now I want to count the number of occurrence of each range.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;First I create a calculated table with the top and bottom range:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gen1 = GENERATESERIES ( -10, 10, 1 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I count the rows for each value:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count1 = 
    CALCULATE ( 
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', [Range] = MAX ( Gen1[Value] ) ) 
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results are as expected, nothing seems out of the ordinary (Gen table 1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now here is the most mind boggling behaviour I found:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I slightly modify my calculated table by incrementing by 0.5 instead of 1:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gen2 = GENERATESERIES ( -10, 10, 0.5 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This returns the exact same results as expected (Gen table 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally I change my table again, this time incrementing by 0.1:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gen3 = GENERATESERIES ( -10, 10, 0.1 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this time the whole calculation breaks (Gen table 3).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understand why this happens. Either I discovered a bug in DAX or there is something fundamental that I don't understand about DAX as by logic this should not be happening.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: Here is the file for reference:&amp;nbsp;&lt;A href="https://www.dropbox.com/s/vhgoxdu95899u99/PowerBI%20Mistery.pbix?dl=0" target="_blank" rel="noopener"&gt;PowerBI Mistery.pbix&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 08:36:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1381460#M25247</guid>
      <dc:creator>zaza</dc:creator>
      <dc:date>2020-09-19T08:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: DAX bug or something fundamental I don't get?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1381501#M25248</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="149408" data-lia-user-login="zaza" class="lia-mention lia-mention-user"&gt;zaza&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have encountered this scenario in a past question and it seems the rounding of decimals by DAX engine has a strange logic.&lt;BR /&gt;&lt;BR /&gt;If you need to have all the numbers from the Gen 3 tables with values, you may try the measure as follows, adjust as per your need. then you get the results as.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count3 = 

    CALCULATE ( 
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', [Range]  = INT(MAX ( Gen3[Value] ) ) ) 
    )&lt;/LI-CODE&gt;&lt;P&gt;________________________&lt;/P&gt;&lt;P&gt;If my answer was helpful, please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt; to help the other members find it&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Click on the &lt;STRONG&gt;Thumbs-Up icon &lt;/STRONG&gt;if you like this reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/channel/UCKwBEguA8IlBubIobaOormg?sub_confirmation=1" target="_blank"&gt;&lt;FONT color="blue"&gt;YouTube&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp; &lt;A href="https://linkedin.com/in/fowmy" target="_blank"&gt;&lt;FONT color="blue"&gt;LinkedIn&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 11:20:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1381501#M25248</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2020-09-19T11:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: DAX bug or something fundamental I don't get?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1381583#M25249</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="52518" data-lia-user-login="Fowmy" class="lia-mention lia-mention-user"&gt;Fowmy&lt;/a&gt;&amp;nbsp;That's not right, I need the count of the numbers that actually appear in my dataset. I also cannot round up the numbers as in my real dataset I will have decimal place numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you say that there is a weird logic how DAX handles decimals, I would like to understand what is going on so I am able to do exact operations on decimal place values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why does the measure evaluete correctly against the first 2 and not the 3rd?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Gen1 = GENERATESERIES ( -10, 10, 1 ) //works
Gen2 = GENERATESERIES ( -10, 10, 0.5 ) //works
Gen3 = GENERATESERIES ( -10, 10, 0.1 ) //does not work&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 16:25:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1381583#M25249</guid>
      <dc:creator>zaza</dc:creator>
      <dc:date>2020-09-19T16:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: DAX bug or something fundamental I don't get?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1382061#M25258</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="149408" data-lia-user-login="zaza" class="lia-mention lia-mention-user"&gt;zaza&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have come up with a solution! I tested with decimal numbers as well and it works.&amp;nbsp; Basically, I converted the [Range] measure and the Value from Gen3 Value to 1 decimal as a text result to compare. Test with decimal numbers to confirm.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The new measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count3 = 
    CALCULATE ( 
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', FIXED([Range],1) = FIXED(MAX ( Gen3[Value] ),1) ) 
    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;________________________&lt;/P&gt;&lt;P&gt;If my answer was helpful, please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt; to help the other members find it&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Click on the &lt;STRONG&gt;Thumbs-Up icon &lt;/STRONG&gt;if you like this reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/channel/UCKwBEguA8IlBubIobaOormg?sub_confirmation=1" target="_blank"&gt;&lt;FONT color="blue"&gt;YouTube&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp; &lt;A href="https://linkedin.com/in/fowmy" target="_blank"&gt;&lt;FONT color="blue"&gt;LinkedIn&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Sep 2020 11:13:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-bug-or-something-fundamental-I-don-t-get/m-p/1382061#M25258</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2020-09-20T11:13:47Z</dc:date>
    </item>
  </channel>
</rss>

