Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
At first I need to set the last day of the previous month:
LET vTODAY = Date(monthsstart(1, today(1))-1,'DD/MM/YYYY');
Then I need to remove one month if we are in January else keep the month as it is:
LET vYearFile = If(Num(Month($(vTODAY))) = 1, AddYears($(vTODAY), -1), Year($(vTODAY)));
I get 1899...
What's wrong with this code? Thank you guys!
LET vYearFile = If(Num(Month($(#vTODAY))) = 1, Year(AddYears($(#vTODAY), -1)), Year($(#vTODAY)));
LET vYearFile = If(Num(Month($(#vTODAY))) = 1, Year(AddYears($(#vTODAY), -1)), Year($(#vTODAY)));
Hi
Try like below
LET vTODAY = Date(monthsstart(1, today(1))-1,'DD/MM/YYYY');
LET vYearFile = If(Num(Month(vTODAY)) = 1, AddYears(vTODAY, -1), Year(vTODAY));
vYearFile gives 2021
Thanks, both solutions are working fine.