Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sculptorlv
Contributor II

Local variables

I have quiet a big report and many tables within it.

In each table I use similar formulas .. like this:

IF (

SUM(if((Sale_Category = 1.1 OR Sale_Category = 1.2), Sale_Money, 0))

/

SUM(if((Budget_Category = 1.1 OR Budget_Category = 1.2), Budget_Money, 0))

< Water_C2,

Is it possible to define formula  s ONE local variable ... like CHECK =.... ???

SUM(if((Sale_Category = 1.1 OR Sale_Category = 1.2), Sale_Money, 0))

/

SUM(if((Budget_Category = 1.1 OR Budget_Category = 1.2), Budget_Money, 0))

a

I can't do it in Settings-Variables (global), because it will not take local filters into account during the calculation.

Tags (1)
6 Replies
balrajahlawat
Esteemed Contributor

Re: Local variables

You can use customized Measure as a local variable,

like this:

Adding Multiple measures in qliksense

sculptorlv
Contributor II

Re: Local variables

Sorry, didn't get it.

I use expressions in simple Table charts. I don't have any X or Y axis.

I just need to replace big formula ... to be like this

IF ( CHECK< Water_C2), ...

MVP
MVP

Re: Local variables

Simply add the variable CHECK in the variable overview to be:

CHECK:

SUM(if((Sale_Category = 1.1 OR Sale_Category = 1.2), Sale_Money, 0))

/

SUM(if((Budget_Category = 1.1 OR Budget_Category = 1.2), Budget_Money, 0))


Then in your expression:


     If(($(Check)) < Water_C2),...

sculptorlv
Contributor II

Re: Local variables

I can't do this. In this case, it will be GLOBAL variable and it will not take into account local filters in my Chart Tables.

sculptorlv
Contributor II

Re: Local variables

Can you please provide easy answer, how to use the variable in Charts expressions, which was defined in Qlick sense?

I defined my variable Let VarialbeX = Today()  ... where I have to define within qlick sense.

But, the system doesn't recognize VariableX within Charts expression.