If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
I am trying to do the following and am unable to figure it out. Does anyone know how I can achieve this?
GoalI have 2 fields: Year and Month_Nbr. In the end, I want them concatenated into the format 'yyyymm'. However, I need it to display 1 month prior to its value.
For example, 201902 would display as 201901; and 201901 would display as 201812; meaning the year would also need to decrease by 1 if the month is January.
This is the formula I came up with, which doesn't work because it reduces the year by 1, not the month. Date(AddMonths(Date#(Num(Year) & Num(Month_Nbr,'00'),'yyyymm'),-1),'yyyymm')
These are the steps I took:
Result: 201902 becomes 201802Desired: 201902 should become 201901
Any guidance is appreciated, thank you.
I think you might have missed the trick by using mm instead of MM. M is for Month and m is for minutes
View solution in original post
Date(AddMonths(Date#(Num(Year) & Num(Month_Nbr,'00'), 'YYYYMM'), -1), 'YYYYMM')
Thank you, that did it!