Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.


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
Contributor III

Re: Set Variables for Current Year and Month

Hi Joshua,

I think you should rename vMonth_Current into vMonth_Previous



Community Browser