Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jworthulf
Creator
Creator

Correcting an expression error in set analysis

I'm working on data set from a book titled "QlikView Your Business" I have an error in the expression that I'm unable to fix and I'm looking for a little help.

sum ({$<$(filter_ThisYear)>}error message starts here. [# Amount] )/

sum ({$<$(filter_PriorYear)>} [# Amount] ) -1

This set analysis is working off of 2 variables

filter_ThisYear = Year={$(=max(Year))}

filter_PriorYear = Year=[$(=max(Year)-1}

troyansky

17 Replies
aarkay29
Specialist
Specialist

filter_PriorYear = Year={$(=max(Year)-1}

aarkay29
Specialist
Specialist

filter_PriorYear = Year={$(=max(Year)-1)}

jworthulf
Creator
Creator
Author

Aar,

Thanks for the response I made some changes to the variables and the error message on Chart is was showing memory exceeded and is now showing "Too few expressions" .   When I go to the expression tab I have an error message "Errors in expression"  with the following formulas in play:

sum ({$<$(filter_ThisYear)>} [# Amount] )/
sum ({$<
$(filter_PriorYear)>} [# Amount] ) -1

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi John,

if you post your whole document, I'll take a look at the variables, and the chart properties, to find our what might be wrong.

best,

Oleg Troyansky

jworthulf
Creator
Creator
Author

QlikviewYourBusiness‌

Just an update to my question I've attached the qvw  I'm working on.    If you go into the expression in the chart properties there is an "expression error" message noted.    The expressions are creating the chart image but I'd like to be able to fix this as I had to type in all the elements of the formula vs using the Qlik auto fill on formulas.

troyansky

suryaa30
Creator II
Creator II

Replace below expression

sum({$<Year={'<$(=$(filter_ThisYear))'>}[# Amount]) /

sum({$<Year={'<$(=$(filter_ThisYear))'>}[# Amount]) -1

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Surya, this won't work unfortunately. Not sure what did you have in mind, but this syntax is simply incorrect.

suryaa30
Creator II
Creator II

Hi Oleg,

Did you try implementing above?

I believe the idea is to assign a  calculated variable in set expression to restrict data based on Year field.

I have implemented above expression and it is working perfectly fine.

please elaborate on the error you are facing

sunny_talwar

I think what Oleg is trying to point out is that the variable is a set analysis syntax in itself...

Capture.PNG

so what you are suggesting is to embbed a set analysis into another set analysis.But the way it is going to be expanded, it is going to be the wrong syntax. Look here what happens when I use your expression in a straight table (converted from the chart)....


Capture.PNG


All nulls.... and this is because of how you are using this (replacing

sum({$<Year={'<$(=Year = {$(=max(Year))})'>}[# Amount]) /

sum({$<Year={'<$(=Year={$(=max(Year)-1)})'>}[# Amount]) -1

Coming back to the OPs question.... Why do you think your expression isn't working? Is it because you see the red wiggly lines? If that's what the concern is, then I would say you don't have to worry about anything because those red wiggly lines are just saying that your expression editor doesn't understand your syntax. This happens when you use set modifier embedded in a variable. Expression editor doesn't know what it will be expanded to and hence shows error. But to see what it is getting expanded to, I converted your chart to a straight table and removed the expression label to see this

Capture.PNG

If this was your goal, then you don't have to worry about anything and you are good to go. But in case this is not what you intended, please clarify what exactly are you looking to get