Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
MaryanVegaC
Contributor II
Contributor II

Error working with variables

Hello,

I have an input variable (V1) where the default value is 2022-05. And I wanna create a subsequent variable to create a range of months from V1. Here it is what I`m trying to do:

Addmonths($(v1),-11)

the expected value should be 2021-06, eleven months earlier, but instead I`m getting 1904-08. Somebody can help me, I don`t understand why Qlik is changing the value. something important is that in the data load editor the date format is SET DateFormat='YYYY-MM';

 

Thank you

 

Labels (1)
1 Solution

Accepted Solutions
Digvijay_Singh

@rwunderlich 

My bad, actually interpretation is not needed as the format is 'YYYY-MM' is updated in the script as mentioned by @MaryanVegaC .

Addmonths('$(V1)',-11) - This also works, so Date/Date# are not needed

 

View solution in original post

4 Replies
Digvijay_Singh

Looks like $(V1) is not interpreted as date, this works - 

Addmonths(Date('$(V1)','YYYY-MM'),-11)

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

@Digvijay_Singh I think you mean Date# ?

-Rob

Digvijay_Singh

@rwunderlich 

My bad, actually interpretation is not needed as the format is 'YYYY-MM' is updated in the script as mentioned by @MaryanVegaC .

Addmonths('$(V1)',-11) - This also works, so Date/Date# are not needed

 

MaryanVegaC
Contributor II
Contributor II
Author

Thanks @rwunderlich  and @Digvijay_Singh   for your help 🙂