Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
Bikoman
New Contributor II

how to use avg and two if statements

I am trying to use an if statement, but i get an error when i type it.
this is the formula: 
If(Avg((If([Daily Change %]>0,1,0)))>0.8,"Invest","Dont Invest") 

this statement does work and it gives a value between 0-1:
Avg((If([Daily Change %]>0,1,0)))

 

Labels (2)
1 Solution

Accepted Solutions
MVP
MVP

Re: how to use avg and two if statements

Replace your double quotes with single quotes and try like:

If(Avg((If([Daily Change %]>0,1,0)))>0.8, 'Invest', 'Dont Invest')

Note: With double quotes, qlik looks for a field rather than treating it as a string. 

2 Replies
Partner
Partner

Re: how to use avg and two if statements

Hi Bikoman,

Do you want to use this in a table or KPI object?

Jordy

Climber

Work smarter, not harder
MVP
MVP

Re: how to use avg and two if statements

Replace your double quotes with single quotes and try like:

If(Avg((If([Daily Change %]>0,1,0)))>0.8, 'Invest', 'Dont Invest')

Note: With double quotes, qlik looks for a field rather than treating it as a string.