<?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 My formula ends in division by zero error and I just don't know why in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168568#M50317</link>
    <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a rather odd problem that I have been working on for the last two hours but still fail to understand where/what exactly the error is. Apparently, "A division by zero has been encountered". But the problem is that my denominator is a fixed value that is not zero. Is there maybe a bug in DAX that leads to this outcome? And if yes, does anyone know a work around for my issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Here is my concrete case&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having the following table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;where the current formula for &lt;EM&gt;CTS&lt;/EM&gt; is&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;CTS = 1.2803*sum(Table1[Number Of Invoices])&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, the 1.2803 is based on column &lt;EM&gt;Result &lt;/EM&gt;which itself is the result of the value in column &lt;EM&gt;Numerator&lt;/EM&gt; over the value of column &lt;EM&gt;Denominator&lt;/EM&gt;&amp;nbsp;(The values in column &lt;EM&gt;Denominator&lt;/EM&gt;, &lt;EM&gt;Numerator&lt;/EM&gt; and &lt;EM&gt;Result&lt;/EM&gt; are always the same which I double checked by generating a data excerpt for Excel in which I confirmed that there are absolutely no zero values.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Accordingly, the formula for &lt;EM&gt;Result&lt;/EM&gt; is&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;Result = Table1[Numerator]/Table1[Denominator]&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I now wish to directly insert the &lt;EM&gt;Result&lt;/EM&gt; value 1.2803 directly into the &lt;EM&gt;CTS&lt;/EM&gt; formula so that it reads&lt;/DIV&gt;&lt;DIV&gt;CTS = &lt;EM&gt;Table1[Result]&lt;/EM&gt;&lt;EM&gt;*sum(Table1[Number Of Invoices])&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I do this, I get the error message&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table is filtered but this should not be an issue for my calculations, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So can anyone please explain to me where this mysterious division by zero is occuring?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Nov 2021 13:20:33 GMT</pubDate>
    <dc:creator>ThomasSan</dc:creator>
    <dc:date>2021-11-02T13:20:33Z</dc:date>
    <item>
      <title>My formula ends in division by zero error and I just don't know why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168568#M50317</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a rather odd problem that I have been working on for the last two hours but still fail to understand where/what exactly the error is. Apparently, "A division by zero has been encountered". But the problem is that my denominator is a fixed value that is not zero. Is there maybe a bug in DAX that leads to this outcome? And if yes, does anyone know a work around for my issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Here is my concrete case&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having the following table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;where the current formula for &lt;EM&gt;CTS&lt;/EM&gt; is&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;CTS = 1.2803*sum(Table1[Number Of Invoices])&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, the 1.2803 is based on column &lt;EM&gt;Result &lt;/EM&gt;which itself is the result of the value in column &lt;EM&gt;Numerator&lt;/EM&gt; over the value of column &lt;EM&gt;Denominator&lt;/EM&gt;&amp;nbsp;(The values in column &lt;EM&gt;Denominator&lt;/EM&gt;, &lt;EM&gt;Numerator&lt;/EM&gt; and &lt;EM&gt;Result&lt;/EM&gt; are always the same which I double checked by generating a data excerpt for Excel in which I confirmed that there are absolutely no zero values.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Accordingly, the formula for &lt;EM&gt;Result&lt;/EM&gt; is&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;Result = Table1[Numerator]/Table1[Denominator]&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I now wish to directly insert the &lt;EM&gt;Result&lt;/EM&gt; value 1.2803 directly into the &lt;EM&gt;CTS&lt;/EM&gt; formula so that it reads&lt;/DIV&gt;&lt;DIV&gt;CTS = &lt;EM&gt;Table1[Result]&lt;/EM&gt;&lt;EM&gt;*sum(Table1[Number Of Invoices])&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I do this, I get the error message&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table is filtered but this should not be an issue for my calculations, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So can anyone please explain to me where this mysterious division by zero is occuring?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 13:20:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168568#M50317</guid>
      <dc:creator>ThomasSan</dc:creator>
      <dc:date>2021-11-02T13:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: My formula ends in division by zero error and I just don't know why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168606#M50318</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="329838" data-lia-user-login="ThomasSan" class="lia-mention lia-mention-user"&gt;ThomasSan&lt;/a&gt;&amp;nbsp;Try this and this will help you identify where the issue is:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Result = DIVIDE(Table1[Numerator], Table1[Denominator],0)&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Or use -1 or something as the alternate result to clearly identify where the division by zero is happening.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 13:29:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168606#M50318</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-11-02T13:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: My formula ends in division by zero error and I just don't know why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168620#M50319</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Greg,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have modified the forma for Result according to your input but there still seems to be no zero&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 13:33:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168620#M50319</guid>
      <dc:creator>ThomasSan</dc:creator>
      <dc:date>2021-11-02T13:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: My formula ends in division by zero error and I just don't know why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168929#M50326</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="329838" data-lia-user-login="ThomasSan" class="lia-mention lia-mention-user"&gt;ThomasSan&lt;/a&gt;&amp;nbsp;My guess is that the blanks are what are causing the issue with the divide by zero. Seems like it is quite possible that you were dividing by BLANK() essentially which caused the divide by zero error. IDK, hard to say without the data and such. Seems like the issue is solved though.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 15:43:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2168929#M50326</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-11-02T15:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: My formula ends in division by zero error and I just don't know why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2173792#M50535</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="329838" data-lia-user-login="ThomasSan" class="lia-mention lia-mention-user"&gt;ThomasSan&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;Has your issue be solved? If not, I have some doubts, it will help to solve your problem if you can reply to me.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;1.I notice that “Result” is a measure, what about “CTS”, is it a measure or column?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;2.When does the DAX error “A division by zero has been encountered” occur? Does it occur after you run “Result” or “CTS”?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;3.What is the error reminder when you modify the DAX to “DIVIDE(Table1[Numerator], Table1[Denominator],0)”?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;4.Is “Numerator” and “Denominator” your original data or calculated data?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;Best Regards,&lt;BR /&gt;Community Support Team _ kalyj&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 02:53:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2173792#M50535</guid>
      <dc:creator>v-yanjiang-msft</dc:creator>
      <dc:date>2021-11-05T02:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: My formula ends in division by zero error and I just don't know why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2178361#M50675</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="334520" data-lia-user-login="v-yanjiang-msft" class="lia-mention lia-mention-user"&gt;v-yanjiang-msft&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unfortunately, my problem has not been solved, yet. To your questions:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;1. CTS is a measure.&lt;/P&gt;&lt;P&gt;2. No. Having "Result" only in a column consistently delivers the same value (here 1.2803€) and curiously does not deliver this error message. This is as expected as the denominator and nominator also stay consitent in each row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. The error vanishes but my DAX formula behind Curve Product is not working correctly (sidenote: it is a running total of all Gross Profit values up until each row. I have created based on the response I got from an earlier question here in the community (&lt;A href="https://community.powerbi.com/t5/Desktop/Cumulative-Totals-from-largest-to-lowest-and-without-date/m-p/2128836#M786892" target="_blank" rel="noopener"&gt;https://community.powerbi.com/t5/Desktop/Cumulative-Totals-from-largest-to-lowest-and-without-date/m-p/2128836#M786892&lt;/A&gt;))&lt;/P&gt;&lt;P&gt;4. The formula are "&lt;EM&gt;&lt;SPAN&gt;Numerator = &lt;/SPAN&gt;&lt;SPAN&gt;Table1&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt;[Total Costs]&lt;/EM&gt;" and "&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN&gt;Denominator = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;Table1[Number Of Invoices]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt; ( Table1&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt;) )&lt;/EM&gt;". The latter is supposed to give me the total number of invoices in order to create the average costs. These average costs per invoice are then used to multiply the average cost of invoices with the number of invoice per product (i.e. how many times has the product been invoiced)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All in all, this is exactly my big mystery here. While PowerBI is perfectly able to calculate each element of my large formula (which is&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;CTS = (&lt;/EM&gt;&lt;EM&gt;Table1[Numerator]/Table1[Denominator] )*sum(Table1[Number Of Invoices]&lt;/EM&gt;&lt;/STRONG&gt;), I am unable to do so by inserting this large formula as CTS since it will result in the above mentioned error message. Even stranger, I fail to understand where exactly a division by 0 is happening as all denominator values are constant (here 3.243).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: I just noticed it is not correct to have denominator in Euros as it is just the total number of invoices. Naturally, that is not a monetary value. However, this should have no effect on my described problem here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 14:55:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2178361#M50675</guid>
      <dc:creator>ThomasSan</dc:creator>
      <dc:date>2021-11-08T14:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: My formula ends in division by zero error and I just don't know why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2182489#M50821</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="329838" data-lia-user-login="ThomasSan" class="lia-mention lia-mention-user"&gt;ThomasSan&lt;/a&gt;&amp;nbsp;，&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;According to your description, because the “Result” formula works fine, I think there’s no zero in your “&lt;/SPAN&gt;&lt;I&gt;&lt;SPAN style="font-family: 'Segoe UI',sans-serif;"&gt;Denominator&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;” column, I guess maybe it’s the aggregation cause your problem. You can try to create a new column like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;Column=[Result]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;CTS =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Segoe UI',sans-serif;"&gt;Table1[Column]*sum(Table1[Number Of Invoices])&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 12.0pt; background: white;"&gt;&lt;SPAN style="font-size: 11.5pt; font-family: 'Segoe UI',sans-serif; color: black;"&gt;Best Regards,&lt;BR /&gt;Community Support Team _ kalyj&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 09:52:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/My-formula-ends-in-division-by-zero-error-and-I-just-don-t-know/m-p/2182489#M50821</guid>
      <dc:creator>v-yanjiang-msft</dc:creator>
      <dc:date>2021-11-10T09:52:59Z</dc:date>
    </item>
  </channel>
</rss>

