Discussion Board for collaboration on QlikView Integration.
i have following dates
now i want to change year in date field.. i dont want to create new year field
i tried this
load ID, fIDate, if(Year(fIDate) = 2009, '2010', if(Year(fIDate) = 2010, '2009', if(Year(fIDate) = 2011, '2012' ))) as I_Year, FROM .....
but this seems like creating new year field .. but i want to change year only in date colmn.. how i do this
I couldn't sense any logic sequence from your requirement, however if you want to add a year or any number of months you can use AddMonts function
Addmonths(fIDate, 12) as fIDate
if this is not the solution you are looking for then do let us know the requirement clearly
my question is
in date field there is year and i want to swap these years in date field
like if i have dates like these
01/01/2009 01/02/2010 01/04/2011
then i want like this
01/01/2010 01/02/2009 01/04/2012
hope u understand
use below condition
if(match(year(date),'2011'),AddMonths(date,12)))) as fIDate
as per your requirement it is only one year to increase / decrease so i used 12 ,
you should explain your full requirement, bits and pieces wont help us
1, is there any logic behind Year switch ??
2, What is date field range??
3, in total how many years are there to swap ??
4, what about future years ??
there is no logic just want to change original data into dummy data so want to swap years ..
year range is 2009 to 2021
so for 2009 this change to 2008
2010 to 2009, 2011 to 2010, 2012 to 2011, 2013 to 2012 , 2014 to 2013 , 2015 to 2014, 2016 to 2015, 2017 to 2016, 2018 to 2017 , 2019 to 2018, 2020 to 2019, 2021 to 2020