Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Issue Moving Set expression to Variable

Hi,

I am moving my set analysis expression to variable and using that variable into charts for calculation but the variable shows error message like "Error:Garbage After Expression 'K'"(In set analysis expression calculates amount and converted amount into 'M'(Million),'K'(Thousand's)).when I used the the variable 'vPremium_Amount' it shows values but not exactly correct, when I used $(vPremium_Amount) it doesn't show any value shows error message.please help me to resolve this issue.

Thanks in advance.

Best Regards

Anusha k


1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

if you use = in variable is already calculated in declararion -->Variable overview.

please post your expression.Might be some where your expression is going wrong.

View solution in original post

4 Replies
Anonymous
Not applicable
Author

if you use = in variable is already calculated in declararion -->Variable overview.

please post your expression.Might be some where your expression is going wrong.

Not applicable
Author

Hi,

Post ur expression as well as variable expression

Anonymous
Not applicable
Author

This is my set expression

If((Sum({<PrYear={"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ SingPremium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear))"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount])) > 1000000,



Num(Round((Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ SingPremium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear))"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount])) /1000000),'$#,##0 M'),



If((Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ SingPremium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount]) ) > 1000,



Num(Round((Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ SingPremium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount])) /1000),'$#,##0 K'),



Num(Round(Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ Sing Premium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount])),'$#,##0')))

I keep this expression into a variable

vAmount=If((Sum({<PrYear={"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ SingPremium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear))"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount])) > 1000000,



Num(Round((Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ SingPremium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear))"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount])) /1000000),'$#,##0 M'),



If((Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ SingPremium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount]) ) > 1000,



Num(Round((Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ SingPremium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount])) /1000),'$#,##0 K'),



Num(Round(Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} ([Life Annual Premium ]*if([  Premium Type]='Z',1,0))+([ Life Sing Premium Amount]*if([  Premium Type]='S',1,0)))

+ Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>}  ([ AnnulPremium Amount]*if([  Premium Type]='Z',1,0))+([ Sing Premium Amount]*if([  Premium Type]='S',1,0)))+

Sum({<PrYear={
"$(=Max(PrYear)-1)"},PrMonth={"=$(=Max(PrMonth))"}>} [ Premium Amount])),'$#,##0')))

If i use this variable $(vAmount) it Shows error like garbage after 'k'
or 'm'.






Anonymous
Not applicable
Author

Thankyou Praveena