I'm seeing "NaN" values from calculations in my visuals. What's causing this issue and how can I fix it?

Calculations that include divisors (i.e. Profit-Discount ratio) that have the possibility of being a value of 0 can cause “NaN” values to appear when aggregating or display your data records:

57%20PM

To fix this, you need to handle cases where your divisor values might be 0 in case statement such as the one below:

case when [col2] = 0 then 0 else [col1]/[col2] end

The above calculation checks if your divisor is a value of 0, and if so it will cause the output of your calculation to just be 0. Otherwise it will default to calculating the ratio as intended originally.

1 Like