Calculated Measure Error

How are others handling a calculated measure returning an error, like divided by 0. For me, it returns a 0 value, but then when sorting by that column, the “error” 0 stays at the top vs showing me the lowest value (the negative %) which is what i want to see at the top, the biggest losers. Does that make sense?

Use a case statement to check for 0 prior to dividing:
CASE WHEN [b] = 0 then 0 ELSE [a]/[b] END