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

28 Replies
vishsaggi
Champion III
Champion III

Try this and see if you gettting error?

= round(

         (

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

            /

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

         )*100,.1

       )

If this does not work can you share your sample file if possible?

becki_kain
Contributor III
Contributor III
Author

what equal?  there is only one equal and it's not at the beginning so i'm confused

thanks

lorenzoconforti
Specialist II
Specialist II

See screenshot below. Do you have an equal (highlighted below in black) as first character in your variable definition?

variable.jpg

becki_kain
Contributor III
Contributor III
Author

yes.  opps.  let me check now

becki_kain
Contributor III
Contributor III
Author

didn't help.  same error with no = at beginning of variable expression and like I said, it works in other equations. that's the part I don't get

lorenzoconforti
Specialist II
Specialist II

Is there any chance you can post your application?

matteo_mi
Partner - Contributor III
Partner - Contributor III

can you show if you put this in the variable total_sales_vol_tp1?

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

also what contain variable  $(TP1)?

becki_kain
Contributor III
Contributor III
Author

that doesn't change anything.  still error.  $(TP1) is a user picked time period in the format of P_201709

becki_kain
Contributor III
Contributor III
Author

same error. 😞

becki_kain
Contributor III
Contributor III
Author

(((BB3/BB1)-(BB6/BB2))*BB1)/(sum({1<[TP]={$(TP1)}>}TOTAL Volume)) also gives "error in expression!"