Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Bikoman
Contributor II
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
tresesco
MVP
MVP

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. 

View solution in original post

2 Replies
JordyWegman
Partner - Master
Partner - Master

Hi Bikoman,

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

Jordy

Climber

Work smarter, not harder
tresesco
MVP
MVP

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.