Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jdean1012
Contributor III
Contributor III

Date Variable Evaluating as a Math Problem

I have two variables in my load script.

Let vCurrentMonthStart = '11/01/2020';

Let vCurrentFiscalYear = Right(YearName($(vCurrentMonthStart), 0, 4), 4);

vCurrentMonthStart works correctly and returns the date 11/01/2020.

vCurrentFiscalYear evaluates vCurrentMonthStart as a math problem and returns 1900 instead of the desired 2021 for our Fiscal Year.  (11/1)/2020 = 0.0054455445544554

What am I doing wrong?  THANKS IN ADVANCE!!!

Labels (2)
1 Solution

Accepted Solutions
jdean1012
Contributor III
Contributor III
Author

I figured it out. Surrounding the vCurrentMonthStart in quotes forced it to evaluate as a date and works now.

Let vCurrentFiscalYear = Right(YearName('$(vCurrentMonthStart)', 0, 4), 4);

View solution in original post

1 Reply
jdean1012
Contributor III
Contributor III
Author

I figured it out. Surrounding the vCurrentMonthStart in quotes forced it to evaluate as a date and works now.

Let vCurrentFiscalYear = Right(YearName('$(vCurrentMonthStart)', 0, 4), 4);