Qlik Community

Ask a Question

New to QlikView

If you’re new to QlikView, start with this Discussion Board and get up-to-speed quickly.

Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
Showing results for 
Search instead for 
Did you mean: 

different reference lines for periods

Hello everyone,

I am kind of new to QV and not very experienced in syntax, so I would like to ask about example of solution for described below issue.

I created graphs with daily values for last three months and added reference lines. Issue is that reference lines differ for months. I would like to add reference lines as calculated Expression and save values for every month as VARIABLES (to be able to fast update values).  I imagine it looks like this:

 =if( MonthName=$(vCurrentMonth)),$(v(reflinecurrentperiod) ,

if( MonthName=$(vCurrentMonth)-1),$(v(reflinepreviousperiod) 

if( MonthName=$(vCurrentMonth)-2),$(v(reflineperiodt-2)      or something like this. 


Can you help with the syntax or suggest any other solution to get desired effect.  Please see attached screenshot. 


Thank you in advance, 


Kind regards,reference lines.PNG










6 Replies

If you could share the variable how it is defined it will easy. Syntax like

=if( MonthName=$(vCurrentMonth), $(vreflinecurrentperiod) ,

if( MonthName=$(vCurrentMonth)-1, $(vreflinepreviousperiod) 

if( MonthName=$(vCurrentMonth)-2, $(vreflineperiodt)-2)))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

I thought about sth like this:






Hello again, 

I created variables as follows:

- CurrentMonth=MonthName(Today())

- RLcurrentLFG=1600

- RL-1LFG=1800

- RL-2LFG=2000,

and added formula as follows as reference line expression: 

=if(MonthName=$(vCurrentMonth), $(vRLcurrentLFG) ,

if(MonthName=$(vCurrentMonth)-1, $(vRL-1LFG) ,

if(MonthName=$(vCurrentMonth)-2, $(vRL-1LFG))))


but still not working. Any hint why?  Thanks in advance!








Digital Support
Digital Support

Jakub, it will be most helpful if you can attach an app, does not have to be the app, but a sample app, or you can go to Settings\Document Properties\Scrambling tab in the Desktop client and choose the fields you want to scramble, so folks cannot see the actual data etc.  In your case, I think it is going to be necessary for folks to be able to see the data model etc. as well as the chart props, variables and expressions in order to get you on the right track.


To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.


Than you for you suggestion. I attached the app.

The desired effect is to apply different reference lines for different months. So if our target changed over periods, I would like to see previous month with previous target and actual month with actual target to be able to compare data and see how target changed also.

Kind regards,


Which chart are we looking to help you with? Also, because of scrambling the data, values within WHSE_Desc have changed and the if statement doesn't work...  make sure to update them so that we can work with the values in some of the chart if that is where you need our help.