Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Zurich on Sept 24th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
becki_kain
Contributor III
Contributor III

syntax error using a variable not an expression

I use this expression as, well an expression (column):

round((sum({1<[TP]={$(TP1)}>}Volume)/$(total_sales_vol_tp1))*100,.1)

where $(total_sales_vol_tp1) is a variable which I set instead of defining that as a separate expression (column) and this expression is fine.  but if I replace this:

Round(((AA1/AA3)*100), 0.01)  where AA1 and AA3 are expressions (columns)

with Round(((AA1/$(total_sales_vol_tp1))*100), 0.01)

I get errors in expression even though all the paranthese match up and i'm just swapping in the variable.  what am I doing wrong, as a new person?

thanks

becki kain

28 Replies
lorenzoconforti
Specialist II
Specialist II

Can you post your application?

vishsaggi
Champion III
Champion III

Time for you to post your sample qvw file to look into. We cant assume what is going wrong.

becki_kain
Contributor III
Contributor III
Author

posted.  if you look at the field (expression), BB9, I should be able to replace everything after / with $(total_sales_vol_tp1) and I can't.  thanks

lorenzoconforti
Specialist II
Specialist II

See the changes I've made in the expression

Works fine for me

becki_kain
Contributor III
Contributor III
Author

you just changed BB9?  see my attached screen shot, when I bring up your version, I still get errors in expression

becki_kain
Contributor III
Contributor III
Author

I'm thinking now that I've tripped on a bug but please let me know what else you changed.  thanks

lorenzoconforti
Specialist II
Specialist II

It's not a bug, it's how the expression editor works. When you evaluate a variable, the expression editor does not know what is it going to be once evaluated (i.e. it's a false error but the expression editor wouldn't know as the evaluation is done on the object).

So, QV is behaving as it should; your expression is correct as you can see the expected value in the chart

becki_kain
Contributor III
Contributor III
Author

I would have never figured out that "errors in expression" is fine.  how do you know when things will work,when you get this error?  just try it?:-(  thanks

Mark_Little
Luminary
Luminary

HI,

When you say you get errors in expressions, I am not sure what you mean,

Are you meaning the '-' in some columns?

I have taken a look at the QVW and it seems ok. Where it has a value of '-' is because your dividing by 0.

Mark