Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Not applicable

Expression Variable not working in charts

Hi Guys,

I am using Variables as expressions and I am having following problem :

When I type =vTotalOrder in the text box then it shows me expected total number of orders as '400'

But when I use the same variable in the expression definition box of a straight table and select any dimension like customer or sales rep or city then it shows me 400 for every customer!

I have imported variables from an excel spread sheet that looks like below

VariableNameExpression
vTotalOrder=count(Distinct(@OrderId))

And then.. I am using following in the load script

// Loading variables from Excel Spreadsheet


Expressions:

LOAD Variable,

      Expression


FROM $(vG.MetricsRoot)\Expressions Ops.xlsx

      (ooxml, embedded labels, table is Sheet1);

// Setting variables the above table


For i = 0 to NoOfRows('Expressions')-1

          LET vName = Peek('Variable', i, 'Expressions');

          LET $(vName) = Peek('Expression', i, 'Expressions');

Next i

LET i = Null();

vName = Null();

Drop Table Expressions;

1 Solution

Accepted Solutions
Digvijay_Singh
Honored Contributor III

Re: Expression Variable not working in charts

Can you try with no '=' sign in the excel definition, it appears as it is calculated once and used the same value every where, without '=' it should be interpreted dynamically in the chart based on selections.

View solution in original post

6 Replies

Re: Expression Variable not working in charts

Hi

Could you provide a sample file to analysis in detail

Digvijay_Singh
Honored Contributor III

Re: Expression Variable not working in charts

Can you try with no '=' sign in the excel definition, it appears as it is calculated once and used the same value every where, without '=' it should be interpreted dynamically in the chart based on selections.

View solution in original post

MVP & Luminary
MVP & Luminary

Re: Expression Variable not working in charts

It's like digvijay pointed it out the equal-sign '='. See for this also: The Magic of Variables.

- Marcus

Not applicable

Re: Expression Variable not working in charts

Thank you digvijay

Not applicable

Re: Expression Variable not working in charts

Thank you marcus_sommer

Digvijay_Singh
Honored Contributor III

Re: Expression Variable not working in charts

I am glad it helped.