Skip to main content
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
Showing results for 
Search instead for 
Did you mean: 

AddMonths AddYears




I have to create tables for N-Printing with amounts for Sales (ActualAmount) and Budgets (BudgetAmount).


The tables should have these amounts for the last two years before actual year, so for 2016 and 2017. Also should there be amounts for the two last months: we have June at the moment, so the amounts should be for April and May.


I have calculated the amounts in the script and in the expressions. I have used addyears and addmonths to calculate the dates and amounts. Important is that next year in January and February the amounts of November and December 2018 are calculated.


I have added a qvd with the calculations in the script and with some tables with the expressions. The tables are one with the amounts calculated in the script and one with the expressions.


I have to develop tables with different dimensions like Date, Markets, Products, etc. That’s why I have added the tables once with Date, once with Markettypes. The amounts and other values are created for testing.


I have used _LY for last year, _BLY for year before last year, _LM for last month, _BLM for month before last month.


At the moment I have the idea that I get the same amounts for April and May, sometimes I don’t get amounts at all.


The only main filter which will be used is ToDay(), derived are year and month.


So I don’t get the results wanted and I hope someone can tell me what’s the best way (script or expressions) and most important what is wrong with my calculations in the script and what is wrong with my expressions.


Perhaps there is a better way to solve my problem, when so I am open for it. Important is that I can created the different tables to use in N-Printing.



Thanks in advance


Regards Court


0 Replies