Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Dinamic variable in base of filters

Hi, I've a graffic where I show the Amount of the last 6 month. I've got 6 variables, like this:

LastMonth = Date(monthstart(Today()), 'MMM-YYYY')

LastMonth1 = Date(monthstart(Today()-1), 'MMM-YYYY')

LastMonth2= Date(monthstart(Today()-2), 'MMM-YYYY')

LastMonth3 = Date(monthstart(Today()-3), 'MMM-YYYY')

LastMonth4 = Date(monthstart(Today()-4), 'MMM-YYYY')

LastMonth5 = Date(monthstart(Today()-5), 'MMM-YYYY')

And my Graffic is like this:

Product=lastMonth5=lastMonth4=LastMonth3=LastMonth2=LastMonth1=LastMonth
Product1

sum({$<Month={'$(LastMonth5)'}>}Amount)

sum({$<Month={'$(LastMonth4)'}>}Amount)

sum({$<Month={'$(LastMonth3)'}>}Amount)

sum({$<Month={'$(LastMonth2)'}>}Amount)

sum({$<Month={'$(LastMonth1)'}>}Amount)

sum({$<Month={'$(LastMonth)'}>}Amount)

I've got 6 expressions for this graffic:

sum({$<Month={'$(LastMonth)'}>}Amount)

sum({$<Month={'$(LastMonth1)'}>}Amount)

sum({$<Month={'$(LastMonth2)'}>}Amount)

sum({$<Month={'$(LastMonth3)'}>}Amount)

sum({$<Month={'$(LastMonth4)'}>}Amount)

sum({$<Month={'$(LastMonth5)'}>}Amount)

The actually Graffic it would be that:

Productmay-12Jun-12Jul-12Ago-12Sep-12Oct-12
Product1100500600485458711

I want to use, in the variable, the max date that I've got in my filters, not Today(). If now I filter for the Date 20111230, my graffic should be this:

ProductJul-11Ago-11Sep-11Oct-11Nov-11Dic-11
Prodcut 145890546612

Then, I need to use in my variable LastMonth the Max. Date that I have in my filters:

LastMonth = Date(monthstart(Today()), 'MMM-YYYY')

LastMonth = Date(monthstart(MaxDateInMyFilter()), 'MMM-YYYY')

How Can I do that?

Thank you very much

Community Browser