Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
LINKEDIN LIVE: Democratizing data to enhance customer-centricity. JULY 29TH REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
KKumar92
Contributor III
Contributor III

Date Format Conversion

I have created a variable in the load script as Follow;

Let vForecastDate = $(vMaxDate)+ 5;

My vMaxDate = Oct-2020, and the expected answer is Nov-2020, Dec-2020, Jan-2021, Feb-2021. But I am getting the answer as 44106, 44107,44018.

I tried several options to convert the above variable into MonthName, but it does not work,

Please advise on the above.

 

Labels (3)
1 Solution

Accepted Solutions
rwunderlich
Luminary Alumni
Luminary Alumni

Dates are stored internally as number of Days. So "+5" advances the date by 5 days, not 5 months.  You can see the formatted date value by wrapping a Date() function around your expression:

Date($(vMaxDate)+ 5)

What you want is the AddMonths() function:

AddMonths($(vMaxDate), 5)

https://help.qlik.com/en-US/sense/September2020/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTi...

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

2 Replies
rwunderlich
Luminary Alumni
Luminary Alumni

Dates are stored internally as number of Days. So "+5" advances the date by 5 days, not 5 months.  You can see the formatted date value by wrapping a Date() function around your expression:

Date($(vMaxDate)+ 5)

What you want is the AddMonths() function:

AddMonths($(vMaxDate), 5)

https://help.qlik.com/en-US/sense/September2020/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTi...

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

KKumar92
Contributor III
Contributor III
Author

Hi Rob,

Thanks for the solution, it is working perfectly.

Thanks Again.