Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
capriconuser
Creator
Creator

month in text object

hi 

 

i have a month field as_month in database and the format in database is 01-jan-2019 etc etc

so i am tring to extract previous month 

i did this in script 

Month(as_month) as Month_N

and in text box object 

i did this 

max(Month_N) -1 

so when i select jan i did not get dec .. i get sep 

 

how i resolve this 

1 Solution

Accepted Solutions
tresesco
MVP
MVP

You should rather use date field to get the previous month like:

 

Month(AddMonths(max(as_month), -1) )

 This way, you could even get previous month from last year. However, if you use only month field, you might not easily get Dec when you are in Jan.

View solution in original post

1 Reply
tresesco
MVP
MVP

You should rather use date field to get the previous month like:

 

Month(AddMonths(max(as_month), -1) )

 This way, you could even get previous month from last year. However, if you use only month field, you might not easily get Dec when you are in Jan.