Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

expression with not null values

Hi all,
I want to calculate the average of the Sales but where the value of the sale is not null!
I try with this expression but nothing 
avg({< [Sales] -= {""} >} Sales)


Someone can help me?

Thanks all.
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hello,

Please, look into attached example. It should give you necessary knowledge to sort out your issue.

Kind regards,

Janusz

View solution in original post

9 Replies
IAMDV
Luminary Alumni
Luminary Alumni

How about this expression ?

avg({< [Sales] -= {"=Null()"} >} Sales)

Cheers - DV

Not applicable
Author

It doesn't work

Anonymous
Not applicable
Author

I think that avg eliminates nulls automatically, no need to do anything about it.  That is, just use

avg(Sales)

Not applicable
Author

No, avg doesn't eliminate null values!
Now I have seen that when the sale value is null it is rappresented in the table as -
I try: avg({<[Sales]-={'-'}>} Sales) but nothing again.

IAMDV
Luminary Alumni
Luminary Alumni

Even, I have assumed that Avg() excludes the Null values. Please can you post the QVW file? It will be easy to see the data. Meanwhile have you tried something like this...

IF(Sales <> Null(), Avg(Sales))

Regards,

DV

Not applicable
Author

Hi,

Avg will always exclude the null and non numeric value. So there is no need to do anything. Use AVG(Sales)

Anonymous
Not applicable
Author

Hello,

Please, look into attached example. It should give you necessary knowledge to sort out your issue.

Kind regards,

Janusz

IAMDV
Luminary Alumni
Luminary Alumni

Janusz - Nice little example! Thanks for sharing.

Cheers - DV

Not applicable
Author

Thanks all!