SOLVED

Divide By Zero Error

Copper Contributor

I'm getting a divide by zero error notification when using the code below on a text box in my power app. Incidentally, the calculation actually shows the correct result; the error is shown in a standard notification banner. If I switch the divide operator to an ampersand to simply connect the values, each value shows as a whole number (and not zero), so this error should not be occurring.

 

Any ideas?

 

Sum(
Filter('Dataset', Record.Value = recordID.Text),
'Value A'
)

/

(
  Sum(
  Filter('Dataset', Record.Value = recordID.Text),
  'Value A'
  )

+

  Sum(
  Filter('Dataset', Record.Value = recordID.Text),
  'Value B'
  )
)

 

 

1 Reply
best response confirmed by automan25 (Copper Contributor)
Solution
I ran across this page which discusses the IfError function. That seems to have fixed my issue. Many thanks to Low Code Lewis!

https://lowcodelewis.com/blog/handling-the-division-by-zero-error-in-power-apps