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

How to get month name in expression label

Hi,

if i don´t select a month or year i want my expression to be labeled as previous month and current year (May 2012). if i select now may, it should be labeled as April 2012. I tried the following expression, but the else statement isn´t working:

='Umsatz ' & if(GetSelectedCount(Month)=0, Monthname(Today()-31), only(Month)-1 and only(Year)-1)

Any ideas?

5 Replies
MayilVahanan

Hi,

     Try this,

          ='Umsatz ' & MonthName(MonthStart(Max(Date),-1))

          Where Date is the field from where you generate the year and month field.

     Hope it helps,

     R.Mayil Vahanan

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
chematos
Specialist II
Specialist II

Another way:

='Umsatz ' & MonthName(AddMonths(Today(),-1))

Not applicable

Hi

Monthname(addmonth(today(),-1)) will work.

Thank you

Meher

michael_maeuser
Partner Ambassador
Partner Ambassador
Author

Sorry no of those answers work correctly.

with today(), it´s not flexible anymore. again, it´s about the lable not the calculation expression. and if i select nothing, the result must currently be: May 2012. if i select e.g. may 2012, it must be april 2012.

if i select november 2011 it must show october 2011. always one month backwards. thanks for helping!

chematos
Specialist II
Specialist II

= if(GetSelectedCount(Year)=1 or if(GetSelectedCount(Month)=1,'Umsatz ' & MonthName(AddMonths(Today(),-1)),

'Umsatz ' & MonthName(Today()))