Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Variable value for previous month

Hello everybody!

I have to display numerical data for two months using text boxes. The value for the current month, and the value for the previous month as shown in the picture. I have a selection bar containing the various months as in attached picture.

I created a variable which shows the current month (August in this case) value, called Variable1.

Now, I want to get Variable1's values for the previous month (July in this case) . What code do i write?

The previous month in code:  =Monthname(max(MonthName)-1)  -  MonthName is the month variable from my table]

The code for the values i have shown under the current month in attached picture i.e August (95.4% & 93.5%) is: =$(Variable1)

[Summary: I want Variable1 value for =MonthName(max(MonthName)-1)]

Thanks a mill!



Tags (2)
3 Replies
Valued Contributor

Re: Variable value for previous month


Use the below script to create the variable2.



Where PERIOD is the Fieldname which contains the date.


Nilesh Gangurde

Contributor III

Re: Variable value for previous month



Not applicable

Re: Variable value for previous month

Thank you Nilesh and Sreenivas for your quick reply!

But I would like to add:

Suppose I do not want to create a new variable and I just want use the old variable Variable1 (it shows the calculated monthly score for current month aka August)

Is there a way where i can write an equation of the form:

Equation:  call Variable 1 for condition Monthname(max(MonthName)-1)

Note: Monthname(max(MonthName)-1) condition must be used

So July value field would be =__________(equation)_____________________  and it would display Variable1's particular value for July..

I am not too well versed in code so you guys are being really helpful!



Community Browser