Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF Function

Hi
I have a problem with the if function. The calculation is bad. I define 2 variables.
v_year = 2011 and v_year_ant=2010
if((sum( {$<Year= '{$(v_year)}', Indicator = {'Sales'}>}Value ))> (sum( {$<Year= '{$(v_year_ant)}', Indicator = {'Sales'}>} Value)),1,0)
I would like to make with the function that if the sum of sales of this year is higher than the previous year gave me a value of 1 and 0 if it was not.
yzx2yuzy
Were is the problem of the function
Thanks in advance yzx2yuzy
2 Replies
rahulgupta
Partner - Creator III
Partner - Creator III

Hey hi,

Firstly i am assuming that you are using this if condition in a Text Object....

Then use:

=if((sum( {$<Year= {$(v_year)}, Indicator = {'Sales'}>}Value )) > (sum( {$<Year= {$(v_year_ant)}, Indicator = {'Sales'}>} Value)),1,0)

I have just removed the Single Quotes you have put in the Year Selections...

Try using this..

Hope this works...!!

Not applicable
Author

Try This:

=if((sum( {$<Year= {"=$(v_year)"}, Indicator = {"Sales"}>}Value )) > (sum( {$<Year= {"=$(v_year_ant)"}, Indicator = {"Sales"}>} Value)),1,0)