Menu
Download Free Trial

How to ignore nulls in average

Hi

Is there a way to ignore nulls when performing an average so those rows are not included in the aggregration?
 
I am returning Json data from an ajax call.  
 
Thanks
 

4 answers

Public
Ian Sadovy Flexmonster September 13, 2017

Hello Antony,
 
Thank you for the question.
Actually, it seems that null‘s are ignored when calculating the average (see http://jsfiddle.net/flexmonster/bmszjju9/).
Please let me know if you have any other questions.
 
Regards,
Ian

Public
Antony Wong September 13, 2017

Thanks for this.  However, if the first value is null, an aggregation cant be performed.  Is there a way round this?

Public
Ian Sadovy Flexmonster September 14, 2017

Hello Antony,
 
Yes, you can do this. Usually, first value used to determine the column type (i.e. string, number, date , etc.).
So, if the first value is null it will be determined by default as string. Therefore, you should set column type explicitly.
Please refer to the updated sample – http://jsfiddle.net/flexmonster/bmszjju9/
Also, here is more documentation about JSON data styles.
 
Hope it helps.
 
Regards,
Ian

Public
Antony Wong 1 day ago

Thanks.  This worked

Please login or Register to Submit Answer