Forum Discussion

tiffanynguyen's avatar
tiffanynguyen
Regular Visitor
9 years ago
Solved

NaN Error

I created a new field, Cost/Quantity, and the output is coming up at NaN. 

 

I was able to see the Cost by year on a bar chart and quantity by year on a bar chart fine, but when I tried to doing Cost/Quantity on a bar chart, I am not getting anything due to NaN values. How do i fix this?

 

Thanks

11 Replies

  • MarcelBeug's avatar
    MarcelBeug
    Community Champion

    Typically you get NaN when dividing 0 by 0.

    So adjust your formula something like if Quantity = 0 then 0 else Cost / Quantity.

    • tiffanynguyen's avatar
      tiffanynguyen
      Regular Visitor

      How do i get rid of this? Would I be able to replace it with 0 or null?

    • Anonymous's avatar
      Anonymous
      Not applicable

      THANK YOU! That was so easy to fix. Thank you!

    • Anonymous's avatar
      Anonymous
      Not applicable

      it is not working for me 


      MarcelBeug wrote:

      Typically you get NaN when dividing 0 by 0.

      So adjust your formula something like if Quantity = 0 then 0 else Cost / Quantity.