Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

MonthName +1 not working

Hi ,

I am trying to display a monthname in the label.

If i select jan then the label should appear Feb

I have tried MonthName+1 ,but no luck

How to get this done ?

Thanks,

Srihari

6 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

First Convert the Month Name data to Yearmonth i.e in Number format (Make it at script level) ..

e.g : 201009

then use the below expression

monthname(date#(Yearmonth-1,'YYYYMM'))

Not applicable
Author

Hi Deepak,

I have changed the format as you suggested.

YearMonth on selecting Nov from the MonthName field is 2010-11.

=(date#(([Yearmonth]),'YYYYMM')) is giving 2010-11. This looks fine.

=MonthName(date#(([Yearmonth]),'YYYYMM')) is not working. I am getting a null value.

=(date#(([Yearmonth]+1),'YYYYMM')) is giving 2022

=(date#(([Yearmonth]-1),'YYYYMM')) is giving 2020. Don't get this weird behavior.

Any suggestions

Srihari

deepakk
Partner - Specialist III
Partner - Specialist III

Dont put a "-' in between. It should be 201011 for 2010-Nov

Not applicable
Author

Even tried that ..The result is same...

deepakk
Partner - Specialist III
Partner - Specialist III

I think you data is this format

20101 ---- 2010-Jan

20102 -- 2010- feb

......

201010 ---2010- Oct

201011 --- 2010 - Nov

if it is you need convert you month to two digits....

Else send you application we can check it out....

I have implemented this many time. so it should work.

Anonymous
Not applicable
Author

Hi Srihari,

Have you tried using:

      addmonths( MonthName, 1)

You can then wrap it in a date function to achieve any formatting, e.g.:

     date( addmonths( MonthName, 1), 'YYYY MMM')

Regards,

Dilyana