Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Im trying to extract the year and month, with functions left and mid, but when I extract the year from '2016-05-01', read 2014 instead of 2016.
Hi,
It's absolutely normal.
Using $(vInicioPrincipalidad) you ask to qlikview an evaluation of the variable vInicioPrincipalidad so it will operate:
2016 - 1 - 1 = 2014 (read - as substraction operator)
You should force use your variable as a text string to do that use single quotes:
let year = left('$(vInicioPrincipalidad)',4);
or in this case you can use the function year to extract year from a date:
let year = year(vInicioPrincipalidad);
Hope it will help.
Regards.
Fernando,
Try this,
Let Year= Left('$(vInicioPrincipalidad)',4);
Hi,
It's absolutely normal.
Using $(vInicioPrincipalidad) you ask to qlikview an evaluation of the variable vInicioPrincipalidad so it will operate:
2016 - 1 - 1 = 2014 (read - as substraction operator)
You should force use your variable as a text string to do that use single quotes:
let year = left('$(vInicioPrincipalidad)',4);
or in this case you can use the function year to extract year from a date:
let year = year(vInicioPrincipalidad);
Hope it will help.
Regards.
Try
Let Year = Left(vInicioPrincipalidad,4);
Thanks Remi, it was really useful!