7 Replies Latest reply: Jan 22, 2014 5:05 AM by ashok Velisetty

# Calculate Max month as a dimension?

Hi All,

Actually i have 8 months, in this 7 months comes under 2013 and 1 month comes under 2014. so here max month should be 1st month

of 2014.How should i calculate max month as a dimension?.i used autonumber function on month&year but 1st month of 2014 giving 1 number so i am getting dec-2013 as a max month.i need jan-2014 as a max month.

plz help me on this.

Thanks,

Ashok.

• ###### Re: Calculate Max month as a dimension?

Define month as concatenation of year and mont i.e. 201307, 201308 ... 201401, the sorting is automatic in this way and even the max

Hope it helps

• ###### Re: Calculate Max month as a dimension?

Hi Ashok,

instead of using the month such as it is, calculate MONTHEND() - that will give you Jan-31-2014 for this January, which should be your max_month, yes? Then calculate the max date out of these and then just plug in a MONTH() function.

• ###### Re: Calculate Max month as a dimension?

Try below expression.

=MonthName(Max(datefield))  //returns like Jan 2014

=Month(Max(datefield))   // returns like Jan

Regards,

Kabilan K.

• ###### Re: Calculate Max month as a dimension?

Thanks kabilan it working fine.

• ###### Re: Calculate Max month as a dimension?

Hi Ashok,

You can also use the MONTHID's instead of Month names like Max({\$<MonthID={"\$(=Max(MonthID))"}>}Month).

• ###### Re: Calculate Max month as a dimension?

Hi,

You can use calculated dimension as MonthName(Max(field)).

HTH

-shruti

• ###### Re: Calculate Max month as a dimension?

I think you can use a Month Number. Suppose your date field name is Period then you can use the below expression in your Load Script to create a Month Number

num(Month(Period)) + if(Year(Period)=Year(Today()),12,0) as MonthNum,

and then you can use it in your chart expressions. Max(MonthNum)