Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
GabrielOtet
New Contributor III

Calculate a value if greater than, with filter

Dear community,

 

I have to calculate the average of a list of values but only for the values that are greater than 480 (as an example).

Unfortunately I'm not able to finish it since i get an error after every solution I have tried until now.

I suppose that it should be something like:

=average(if(Column1>'480',({<[Column2]={"Good", "Super"}, .....>} [Column1]))

But it seems that I'm not allowed to use that filter ({<[Column2]={"Good", "Super"}, .....>} (without it is working).

 

Can someone help me here?

 

With best regards,

Gabriel

1 Solution

Accepted Solutions
miguelbraga
Valued Contributor III

Re: Calculate a value if greater than, with filter

Hi there,

 

I guess that you would want something like this:

 

=avg({<[Column2]={"Good", "Super"}, .....>} if(Column1 > 480, [Column1]) )

 

Can you try this way, I think the way you were trying to build the expression were wrong. Try my approach and tell me what happens.

 

Best regards,

MB

4 Replies
rupamjyotidas
Valued Contributor

Re: Calculate a value if greater than, with filter

Try

=avg({<Column2={'Good'}>}if(if(Column1>480,Column1))

miguelbraga
Valued Contributor III

Re: Calculate a value if greater than, with filter

Hi there,

 

I guess that you would want something like this:

 

=avg({<[Column2]={"Good", "Super"}, .....>} if(Column1 > 480, [Column1]) )

 

Can you try this way, I think the way you were trying to build the expression were wrong. Try my approach and tell me what happens.

 

Best regards,

MB

GabrielOtet
New Contributor III

Re: Calculate a value if greater than, with filter

Many thanks, it works!

GabrielOtet
New Contributor III

Re: Calculate a value if greater than, with filter

Thank you for the help, it would be a solution but there I think that is an additional if which should be taken out. If this is corrected then the solution works.