Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
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

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
MayilVahanan

Hi

Could you provide a sample file to analysis in detail

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Digvijay_Singh

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.

marcus_sommer

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

- Marcus

Not applicable
Author

Thank you digvijay

Not applicable
Author

Thank you marcus_sommer

Digvijay_Singh

I am glad it helped.