cancel
Showing results for
Did you mean: Frequent Visitor

## Divide by Zero error

Hi,

Here is my dax measure: AVG = CALCULATE(IF(
OR(ABS([Sales]) = 0, ABS([Pounds]) = 0),0,DIVIDE([Sales],[Pounds)))
I got correct answer for all columns but except one, it shows very small number(-6,219,471,085,398,656) after I using this measure, it should be showed as zero.
What is the issue with it? 1 ACCEPTED SOLUTION  Resolver V

for except this error you should use ROUND

``````AVG =
var _sales=Round([Sales],2)
var _pounds = Round([Pounds],2)

var _result = CALCULATE(IF(
OR(_sales = 0, _pounds  = 0),0,DIVIDE(_sales,_pounds ))

return _result``````

5 REPLIES 5  Super User

Why the ABS?

if you want to check if the measure is 0 (not blank), use [Sales] == 0

In doing so, you are also helping me. Thank you!

Proud to be a Super User!  Resolver V

for except this error you should use ROUND

``````AVG =
var _sales=Round([Sales],2)
var _pounds = Round([Pounds],2)

var _result = CALCULATE(IF(
OR(_sales = 0, _pounds  = 0),0,DIVIDE(_sales,_pounds ))

return _result`````` Frequent Visitor

Thanks for the solution! I solved it  Resolver V

please mark this topic as solved 🙂  Resolver V

hello

it is mean what in [pounds] you have number 2.66E-14

another words it is not 0 it is very small number Announcements #### The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates. #### Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!  