Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Team
I have a field name as "Year". It has only one value ie. 2015. When I am writing the below expression it is not giving me correct result.
=if(Year<=Year(today()),1,0)
ie. 2015<=2017 it should give output as 1, but it is giving 0.
When I use a variable instead of Year Field.ie
a=Year
And replace the expression by:
=if($(a)<=Year(today()),1,0)
Then it is working.
So, is it because we have predefined Year function name?
Is there any other way to do this?
Please suggest.
Thanks in Advance
If you have really one Year then it should return one, If you have more than one it returns zero because Qlik can not identify from Year field to comparison. If you try same expression in straight table this works like charm but not in table box..
Write this in the variable with Max key word
=if( Max(Year) <= Year(today()),1,0)
This i suggest for the variables another one is because what ever value you have in your field you have to find it and get selected on any variable or a max value or may be Getfieldselections(Year) but this works when you have select any value in the Year field.
Let a = Max(Year);
Let b= if( $(a) <= Year(Today()),1,0);
As Anil said, in the variable it is storing single value at a time that's why it is working properly but when you are directly using there must be more than 1 value for Year and thus not working.
BR,
Neha
Not working
Are your sure it is working at my end can you share sample file.
You can't say direct without checking. This should work as expected. But the reason you are saying it's not working that means i believe you are doing some end BTA for others. So, We would like to offer you before not knowing anything until unless something guess ..
Check the attached sample app