Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

error in expression:')' expected

Hi team,

Good day

i am facing below issue

i create two variables like below

mattend : num(sum(attend),'####0')

mnotattend  : num(sum(notattend),'####0')

using above two metrics i created variables above variables getting exact numbers but

if i use these variables in  some other calculations

like below

mtotalattend : NUM($(mattend) + $(mnotattend),'###,#####')

mattend% : num(if($(mtotalattend)<>0,Round(($(mattend) / $(mtotalattend)) * 100,0.2),0),'#,##0')&'%'


i am getting error  "error in expression:')' expected"

i am not able to figure out where i did mistake Capture.PNG


please help me  with correct code


Best Regards,

Bob




9 Replies
sujeetsingh
Master III
Master III

check that you are not using = sign before deriving variables. If you are working in qv12 version then remove extro closes of () brackets.

Not applicable
Author

Can u write = in front of your variable declaration and try again.

Also, try like this :

1.mtotalattend : NUM($(=mattend) + $(=mnotattend),'###,#####')


2.mattend% : num(if($(=mtotalattend)<>0,Round(($(=mattend) / $(=mtotalattend)) * 100,0.2),0),'#,##0')&'%'


Thanks

Khushboo

Not applicable
Author

Try like below,


=num(

if(

$(mtotalattend)<>0,

Round(($(mattend) / $(mtotalattend)) * 100,0.2),0)


,'#,##0%')


Make sure your variable expression should return valid result.Else it will return "error like above".

avinashelite

Try like this

mattend : =num(sum(attend),'####0')

mnotattend  : =num(sum(notattend),'####0')

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Most probably, one of your $-sign substitutions in the expressions expands to...nothing. Check spelling (lower/upper case, identical characters etc.) and proper value assignment for all variables.

If you have no idea where to start, try by elimination. Cut your expression to pieces and use each piece. Continue with the one that still generates error messages.

Best,

Peter

Anonymous
Not applicable
Author

Hi Bo66y:

Change your variables like this:

mattend : num(sum(attend),'####0')

mnotattend  : num(sum(notattend),'####0')



If you are formating your expression when you use the variables, you don't need to format here.


Regards!

Anonymous
Not applicable
Author

Hi  buddys,

I tired below logic's but it not useful for me

A.

mattend : num(sum(attend),'####0')

mnotattend  : num(sum(notattend),'####0')    but again i am facing same issue


B.

1.mtotalattend : NUM($(=mattend) + $(=mnotattend),'###,#####')


2.mattend% : num(if($(=mtotalattend)<>0,Round(($(=mattend) / $(=mtotalattend)) * 100,0.2),0),'#,##0')&'%'.


C.

the below logic i am getting total average but i need individual results:

like in "A class" is the dimension i need to display related to "A class" attend % but using the below code it showing total avg

mattend : =num(sum(attend),'####0')

mnotattend  : =num(sum(notattend),'####0')


i am using   qv11



Thanks for sharing your idea

please think advance how i can resolve the issue?




Regards,

Bob


Anonymous
Not applicable
Author

Hy Bo66y,

Could you share an example of your app please?

Regards!

Not applicable
Author

Hi Bo66y,

does your problem still exist?

Please check your attribute expressions like

- Background Color

- Text Color

- Text Format

Qlik.PNG

Maybe there you can find the missing ')'

Regards,

Klaus