Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

1 Solution

Accepted Solutions
lorenzoconforti
Specialist II
Specialist II

See the changes I've made in the expression

Works fine for me

View solution in original post

28 Replies
vishsaggi
Champion III
Champion III

May be try this?

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

becki_kain
Contributor III
Contributor III
Author

with just adding the ''?  nope

'$(total_sales_vol_tp1)'

I still get errors in expression

lorenzoconforti
Specialist II
Specialist II

Can you please share how total_sales_vol_tp1 is defined?

vishsaggi
Champion III
Champion III

Can you share the expressions you are using for AA1, AA3 and your variable expression too.

?

becki_kain
Contributor III
Contributor III
Author

=sum({1<[TP]={$(TP1)}>}TOTAL Volume)

becki_kain
Contributor III
Contributor III
Author

aa1 is =round((sum({<[TP]={$(TP1)}>}Volume)/$(total_sales_vol_tp1))*100,.1) as a field/column/expression

aa3 is sum(TOTAL{<[TP]={$(TP1)}>}Volume)

variable is =sum({1<[TP]={$(TP1)}>}TOTAL Volume)

lorenzoconforti
Specialist II
Specialist II

Try removing the equal sign

becki_kain
Contributor III
Contributor III
Author

that's not where i'm getting the error.  i'm getting the error at :

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

lorenzoconforti
Specialist II
Specialist II

I understand

try removing the equal sign from your variable definition

sum({1<[TP]={$(TP1)}>}TOTAL Volume)


without the equal sign at the beginning