Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
New Contributor

Variable depending on other variable

Hi everyone,

fist of all, let me introduce myself. I'm head of Controlling department and an expert of excel and vba for excel, recently I have discovered Qlik sense and now I'm a beginner. Let me introduce you my problem.

I have a chart with a variable in the measure


This variable is automatically changed by an extension called "Variable", which let me change the measure by clicking buttons.

For example, if I click in SG&A button, this extension introduce in the variable vSG&A the value '[Selling exp.] + [GA exp.]' and the chart shows this addition, if I select Selling Expenses button, the variable introduce only '[Selling exp.]' and the chart is updated with this info.

It works perfectly.

Well, the problem is that I would like to update the reference line with my forecast too. But the Forecast figures are in other measures called [Selling exp. FC]. I have created a new variable and introduced this function in the reference line the next:

=Sum({$<[Month_Key]={$(vForecast)}>}$(vSG&A FC))

And the key for me is the definition of this new variable (vSG&A FC). I want that depending on the value of vSG&A the vSG&A FC has one or other value. ¿Is it possible?

I have written the next in the definition of the variable but it's not working:

=if( $(vSG&A)='[Selling exp.] + [GA exp.]','[Selling exp. FC] + [GA exp. FC]',

if( $(vSG&A)='[Selling exp.]','[Selling exp. FC]',


What's wrong??

Thanks an advance for your support.