How to best handle the numerator blank in DIVIDE?

Viewed 504

Divide handles division by zero error by returning alternate result. However if the numerator is blank then it returns blank.

There are 3 ways to solve this:

  1. COALESCE(DIVIDE(n,d),0)

  2. Use IF to check whether ISBLANK(n) then return 0 otherwise perform the division.

  3. Use +0 - example: DIVIDE(n+0,d)

Which of the above is the most performant and clean approach?

1 Answers

The most performant and clean approach is to leave the blanks. You should be really careful when converting blanks due to the issues described in the link above, since you force a value to always return, when used in a table or chart, it will always show values for groupings where it shouldn't have to.

If you are using the measure in a card, you can get away with using any of the 3, or DIVIDE(n, d, 0) as the difference in performance between them should be negligible.

Related