Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jcampbell
Partner - Creator
Partner - Creator

Set Variables for Current Year and Month

Just wanted to share something I created recently for a project in QlikView 11. I need to store in Variables the current Year and Month. For comparison purposes I decided to also store the previous year too. First create the following Variables:

1. "vYear_Current"

2. "vYear_Previous"
3. "vMonth_Current"

Then add the following to your Load Script

LET vYear_Current = Year(Today());

LET vYear_Previous = Year(Today()) -1;

LET vMonth_Current = Month(Today());

Once you refresh the QVW those variables will populate with the current year, current month and previous year values based on the date of the local computer or server.

1 Reply
Anonymous
Not applicable

Hi Joshua,

I think you should rename vMonth_Current into vMonth_Previous

Cheers,

Antoine