4 Replies Latest reply: Sep 20, 2012 5:10 AM by dave1982

# Max Month or Current Month

Hi,

Consider the following data

Month               Value

201204             500

201205             750

201206             850

201207             600

201208             900

201209             (blank)

I want to show, in a text box, the value for max(Month()-1). The textbox should always show the Value 900 (for this specific set of data), even when I choose another Month. Of course when month 201210 is added the 201209 Value will be filled in, and this is at that point the Value that should be shown in the text box.

How should I construct such a formula ?

Thank you,

David

• ###### Re: Max Month or Current Month

sum({<Month={"\$(=max(Month)-1)"}>} Value)

But you need to add a check when Month - 1 goes to previous year.

• ###### Re: Max Month or Current Month

Hi Ioannis,

Thanks for the input!

First of all, how do I check for previous year as you describe?

Also, when I use your formula it is not showing the Max()-1 result when I do a selection on month, in fact it returns the selected month's result. How can I adjust the formula to only return the Max()-1 month eventhough another month is explicitely selected?

Thank you,

David

• ###### Re: Max Month or Current Month

=sum({<Month={"\$(=max({<Month=>} Month)-1)"}>} Value)

and a check would be something like :

if(right(Month,2) - 1 < 52 etc

• ###### Re: Max Month or Current Month

Thank you Ioannis! This is what I am looking for!