Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rsdhavle
Creator III
Creator III

Max of Month names

I have month field values as  Jan, Feb, Mar...

When i calculate max of month it gives me numbers like 12,11,10..etc How can i get month names instead of these numbers like Dec, Nove, Oct...etc

1 Solution

Accepted Solutions
tresesco
MVP
MVP

12 Replies
tresesco
MVP
MVP

Use MaxString()

rsdhavle
Creator III
Creator III
Author

when I do Maxstring(Month) - 1 again it gives number as '11' instead of Nov..how can we handle that as we have to show trend of last 12 month with names

tresesco
MVP
MVP

Are you trying it with a chart? Could you post a sample? I guess you don't have to subtract one after another from month to achieve this. there would be a simpler way.

rsdhavle
Creator III
Creator III
Author

I am doing it in a chart in which i dont have dimension..I have 12 separate expressions as per our data

tresesco
MVP
MVP

Then for second highest month try like: =Month(MakeDate(1,Max(Month)-1,1))

Or if you have a date field you could try: =Month(AddMonths(Max(Date),-1))

katetsan
Creator
Creator

Hi Tresesco,

I'm using maxstring function in my pick expression, and it doesn't work.

Could you please give me some advise?

Variable:

vCurrentMonth = MaxString(Month)

vLastMonth = Month(MakeDate(1,Max(Month)-1,1))

Expression:

pick(Dim,

sum({<rpt_type = {'Actual'}>}pdc_profit_all),

sum({<Month = {$(=$(vCurrentMonth))},rpt_type = {'Actual'}>}pdc_profit_all) - sum({<Month = {$(=$(vLastMonth))},rpt_type = {'Actual'}>}pdc_profit_all)

)

tresesco
MVP
MVP

Try like:

vCurrentMonth = Month(MakeDate(1,Max(Month)))

katetsan
Creator
Creator

Hi Tresesco,

It shows the value when I use the MaxString function, but It doesn't work when I use the expression as you mentioned.

Kate

its_anandrjs

In a variable try this will find the Max value in the Month Field

vCurrentMonth = Month( {1} MakeDate(1,Max( {1} Month)))