Articles in this section
Category / Section

How to avoid calculations resulting in infinity in Bold BI

Published:

When working with data, you may encounter situations where the result of a calculation is infinity. In such cases, you might want to replace the infinity value with 0 or leave it blank. This article will guide you on how to achieve this using an IF expression.

Steps to Replace Infinity with Zero or Blank

In the below mentioned scenario, the requirement is to calculate average for completed attempts. The average returned infinity as the denominator is zero, so we need to modify it accordingly so that the infinity value is replaced.

  1. Create an expression as follows:
    ISComplete = IF(SUM([isComplete])=0, NULL, SUM([isComplete]))
    
  2. Calculate average using the below expression
    SUM([Attempts])/ [ISComplete]
    

Now the data will be shown as expected, with infinity values replaced by zero or left blank.

Example

Consider the following sample data:

Student Attempts isComplete
A 5 1
B 3 1
C 0 0

Using the expressions mentioned above, the data grid will display the following:

Student Attempts isComplete AVG Attempts
A 5 1 5
B 3 1 3
C 0 0 0

In this example, the infinity value that would have resulted from dividing by zero is replaced with a zero in the AVG Attempts column.

Additional References

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
RM
Written by Reethika Moovendhan
Updated:
Comments (0)
Please  to leave a comment
Access denied
Access denied