Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello. I try to write if statement in load part of the script. I have "sale date" in format YYYY-MM-DD hh:mm:ss. I need to add column with value that depends on year.
According to qlik sense help i've written in load that line:
if(Date("sale date",'YYYY')=2011,'CY','LY') as newfield,
but it shows only LY when year is 2011,2010 and in the rest of years there is '-'
so it makes me a little confused what to do with it.
Thanks in advance very much.
Hi Kamil,
try this:
if ( year([sale date]) = 2011 ,'CY','LY') as newfield - assuming that the field is recognised as a date field
other wise use this:
if ( year(date#([sale date],'YYYY-MM-DD')) = 2011,'CY','LY' ) as newfield