Forum Discussion
division by zero
- 10 years ago
KamilaOlek you can turn on feture to allow unrestricted measures in directquery which should then be able to use IFERROR function. You can go to File -> Options and settings -> DirectQuery.
- 10 years ago
What about just a simple IF statement?
=IF([QuantityKG] = 0,0,DIVIDE([NetValue],[QuantityKG])
You can also use DIVIDE function, probably a little cleaner:
=DIVIDE([NetValue],[QuantityKG],0)
DIVIDE will return the 3rd parameter as the value if a divide by zero occurs.
What about just a simple IF statement?
=IF([QuantityKG] = 0,0,DIVIDE([NetValue],[QuantityKG])
You can also use DIVIDE function, probably a little cleaner:
=DIVIDE([NetValue],[QuantityKG],0)
DIVIDE will return the 3rd parameter as the value if a divide by zero occurs.
- Anonymous8 years agoNot applicable
Greg_Deckler Can I do this for a custom column ?
I tried it and got an error "Expression.Error: The name 'DIVIDE' wasn't recognized. Make sure it's spelled correctly." - DuaneDLB7 years agoAdvocate II
I like your suggestion how to handle division by zero. I created this measure but need to change it to only calculate when a specific value is met.
% Driving Hrs = DIVIDE(sum(DriverLogs[driving_hrs]), sum(DriverLogs[eleven_hr_rule]) + sum(DriverLogs[driving_hrs]),0)I need to figure out how to create this measure to only calculate when DriversLogs[Off Duty Hrs] < 24. suggestion? Thanks