Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable as a Dimension ( or Variable Dimension)

Hi!

I'm struggling trying to know why this happens:

Dimension (Option A): =if(SupContrato > 26000 , SupContrato, null())

Dimension (Option B): =if(SupContrato > $(Rango4), SupContrato, null())

Option A works perfectly: it lists only the contracts which have a surface higher than 26.000sqm

Option B: I change the 26000 for a variable that I declare within the script:

Set Rango4 = 4*(max(SupContrato)/5); but it does not work because it gets null for everything.


Many thanks for any help

1 Solution

Accepted Solutions
kuba_michalik
Partner - Specialist
Partner - Specialist

I think you want that variable calculated globally, not in place when defining the dimension. Put an extra equal sign in front of it:

Set Rango4 ==4*(max(SupContrato)/5);

This will store the equal sign in the variable definition, so it will be calculated like any other variable which begins with =

View solution in original post

5 Replies
martinpohl
Partner - Master
Partner - Master

You defined Rango4 by set, so there is a formula, not a value in.

Therefor you need to calculate the variable in the definition

Use

Dimension (Option B): =if(SupContrato > $(=Rango4), SupContrato, null())

Regards

stigchel
Partner - Master
Partner - Master

Try

$(=Rango4)


The = sign means evaluate the next expression, without text is assumed

kuba_michalik
Partner - Specialist
Partner - Specialist

I think you want that variable calculated globally, not in place when defining the dimension. Put an extra equal sign in front of it:

Set Rango4 ==4*(max(SupContrato)/5);

This will store the equal sign in the variable definition, so it will be calculated like any other variable which begins with =

Not applicable
Author

Thanks Martin! But it does not work neither, I have try that already.

I have also tried to make a LET instead of a Set, but nothing.

Also to declare another variable: Rango4Bis which calls the variable Rango4...nothing neither.

Also to insert the formula of the variable within the dimension instead of the variable...nothing

The only thing that works is to put a figure, not a formula or variable.

It does not make sense to me...any other suggestion?

Many thanks in advance.

BQ.

Borja Quintero.

CBRE Spain. GCS.

Architect.

+34670899622

De: Martin Pohl

Enviado: Friday, October 24, 2014 10:43 AM

Para: Quintero, Borja @ Madrid

Asunto: Re: - Variable as a Dimension ( or Variable Dimension)

Qlik Community<http://community.qlik.com/>

Variable as a Dimension ( or Variable Dimension)

reply from Martin Pohl<http://community.qlik.com/people/MartinPohl?et=watches.email.thread> in Scripting - View the full discussion<http://community.qlik.com/message/640918?et=watches.email.thread#640918>

martinpohl
Partner - Master
Partner - Master

to check the value of the variable create a straight table chart with the formula from the dimension and check the result by mouse over

Regards