Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
379SSS
Contributor III
Contributor III

ERROR in Expression

Hi All,
I have created a variable in the front end, and I was wondering below expression gives me an error in expression. Can anyone help me out to achieve this? for the view SSS and VVV is working fine when I want to see both (SSS,VVV) its troughing me error.

if( $(vView)='SSS', [SSS DEAL SIZE],
if($(vView)='VVV',[VVV DEAL SIZE],
if(match($(vView),'SSS','VVV'), [SSS+VVV Deal SIZE])))

Labels (6)
1 Solution

Accepted Solutions
marcus_sommer

I suggest to go another and more simpler way - by adjusting the data-model in regard to the size-information and not using several fields in a crosstable-structure for it else a value- and a type-field. With it your expression could be look like:

count({$<
Product=p(MySelection),
[Size Value]={'over 75k'} , [Size Type]=p(MySelection),
 Name -={'Unspecified'} ,[Fiscal Year]={'$(vCurrentFY)'} >}
distinct [ Id])

whereby MySelection refers directly to the product-selection or it might be controlled by selections against an island-table.

This means a single calculation would be enough which would save significantly performance (an if-loop calculates at first always all parts and after this step the evaluation of TRUE/FALSE of the branches will be performed) and also a lot of efforts within the UI design. 

View solution in original post

5 Replies
Mark_Little
Luminary
Luminary

Hi,

How are you populating your Variable?

Start by checking that the values in the variable are you what you expect.

My guess here though is with the Match. I believe it is saying where vView is 'SSS' or 'VVV'. Getting an error as their no valid argument when selecting. Check what value is in your variable when you make the required selection and change you last if to be vView equal to that. 

Can prove the theory quickly by add an else argument like below.

if( $(vView)='SSS', [SSS DEAL SIZE],
if($(vView)='VVV',[VVV DEAL SIZE],
if(match($(vView),'SSS','VVV'), [SSS+VVV Deal SIZE],'Fail')))

379SSS
Contributor III
Contributor III
Author

Hi @Mark_Little,

Suppose I have a product filed and it contains values like SSS, VVV
eg.
ID, Products
1, SSS
2, VVV

  I have created a variable vView and assigned fixed values using variable input like 

For SSS label and value is same 'SSS '
For VVV same as above value 'VVV'
For SSS&VVV value is =chr(39)&'SSS'& chr(39)&','& chr(39)&'VVV'& chr(39)
Now I based on above info i have created three buttons side by side like
1.SSS
2.VVV
3.SSS&VVV
so when i select 1st button it should populate SSS related data and same for VVV and for SSS&VVV it should populate Count of SSS+VVV related data 

Also I have tried the above one still it is showing me error in expression. 

I want to use with same values because if I use 1,2,1+2 then the values might disturb my other charts. I used Product = {$(vView)} in other KPI's

Below is my actual expression.

if( $(vView)='SSS', 
count({$<
Product={'SSS'},
[SSS Size]={'over 75k'} ,
 Name -={'Unspecified'} ,[Fiscal Year]={'$(vCurrentFY)'} >}
distinct [ Id]),
if($(vView)='VVV', 
count({$<
Product={'VVV'},
[VVV Size]={'over 75k'} ,
 Name -={'Unspecified'} ,[Fiscal Year]={'$(vCurrentFY)'} >}
distinct [ Id]),
if(match($(vView),'SSS','VVV'),
count({$<
Product={'SSS'},
[SSS Size]={'over 75k'} ,
 Name -={'Unspecified'} ,[Fiscal Year]={'$(vCurrentFY)'} >}
distinct [ Id])
+

count({$<
Product={'VVV'},
[VVV Size]={'over 75k'} ,
 Name -={'Unspecified'} ,[Fiscal Year]={'$(vCurrentFY)'} >}
distinct [ Id]))))

marcus_sommer

I suggest to go another and more simpler way - by adjusting the data-model in regard to the size-information and not using several fields in a crosstable-structure for it else a value- and a type-field. With it your expression could be look like:

count({$<
Product=p(MySelection),
[Size Value]={'over 75k'} , [Size Type]=p(MySelection),
 Name -={'Unspecified'} ,[Fiscal Year]={'$(vCurrentFY)'} >}
distinct [ Id])

whereby MySelection refers directly to the product-selection or it might be controlled by selections against an island-table.

This means a single calculation would be enough which would save significantly performance (an if-loop calculates at first always all parts and after this step the evaluation of TRUE/FALSE of the branches will be performed) and also a lot of efforts within the UI design. 

379SSS
Contributor III
Contributor III
Author

Hi @marcus_sommer ,

Thanks for your response!

I will try and let you know

379SSS
Contributor III
Contributor III
Author

Hi @marcus_sommer 

Thanks for your help it's working