Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Make average ignore NULL, BLANK and hyphen fields

How can I make average (avg) function to ignore NULL, BLANK and hyphen ( - ) fields? I only want average to take into account valid numeric values. At the same time, I want to make the average of certain fields complaining a criteria (Order Type='Pending').

=avg({$<[Order Type] = {"Pending'}>} if(isNumeric([Hours]), [Hours])))

it will be equivalent to:

=sum({$<[Order Type] = {'Pending'}>}[Hours])/count({$<[Order Type] = {'Pending'}>}if(IsNum([Hours]),[Hours]))

Is it correct?

4 Replies
Not applicable
Author

do you try this?

=avg({$<[Order Type] = {"Pending'}>} [Hours])

Not applicable
Author

Does avg function ignore by default Null, blanks and hyphen fields as sum function does? I mean, I suppose avg function is not taken into account the nulls, blanks and hyphen fields (non-numeric) when performing calculations. Am I right?

Anonymous
Not applicable
Author

yes avg ignore those troublemakers by default.

Not applicable
Author

the avg function ignores everything that is not number