Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

1 Solution

Accepted Solutions
giakoum
Partner - Master II
Partner - Master II

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

and a check would be something like :

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

    

View solution in original post

4 Replies
giakoum
Partner - Master II
Partner - Master II

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

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

Not applicable
Author

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

giakoum
Partner - Master II
Partner - Master II

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

and a check would be something like :

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

    

Not applicable
Author

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