This will require Builder privileges for setup and implementation.
Issue:
While working with expressions. Especially when there are calculations being made by dividing one Y axis by another, one will always encounter divide by zero errors wherever the denominator (divisive axis) contains either nulls or zeros. The following message pops up on the chart. Note: NaN = Not a Number
Resolution:
Within the expression one will have to add checks wherever the values are null or zero to avoid such errors. You can make your expressions more robust by testing for nulls or zeros by:
if(y2==0 || || y2==null){0;}
else
{(y1-y2)/y2*100;}
Another more reliable example, would be to simply test if the Boolean value of y2 is false.
if( !y2 ) {0;}
else
{(y1-y2)/y2*100;}
One could also test for y2 having the JavaScript value Not a Number with the isNaN function.
if(!y2 || isNaN(y2))
{0;}
else
{(y1-y2)/y2*100;}
It is extremely unlikely that y2 would have the value of NaN if it came from a numeric database column. However, sometimes the results of calculations can be NaN, so the isNaN function is good to have handy. Mathematically the NaN function is undefined if a number is divided by zero. Sorry mathematics lovers, there are currently no indeterminate forms.
For More Information:
- iDashboards Builder Manual 14 Analytics
- JavaScript Expression Help
- JavaScript: Derived Columns
Disclaimer: iDashboards Technical Support Engineers are not Data Analysts who know in depth SQL Queries or JavaScript Expressions. We often learn these skills on the job and have limited knowledge. We do our best to help you with your software in determining if: you are not leveraging the software in the best way for your data or you found a bug in the software, because we want to assist you in your success. If you have issues with in depth queries or expressions please contact iDashboards Support and know that it will take a bit of time to figure out what is necessary for this issue, and if necessary we will refer you to your Client Success Manager to schedule time with a Principal Product Engineer.
If the above is unable to resolve the issue, then please contact iDashboards Support for further assistance.
Comments
0 comments
Please sign in to leave a comment.