Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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
suryaa30
Creator II
Creator II

I get it I simply assumed we had

filter_ThisYear = max(Year)

suryaa30
Creator II
Creator II

if this was the case

filter_ThisYear = max(Year)


then below expression is workable right?@sunny talwar

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

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

sunny_talwar

Yes, this or may be without dollar sign expansion

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

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

suryaa30
Creator II
Creator II

Hi Oleg,

I didnt notice the variable to be set expression.

I simply assumed we had

filter_ThisYear = max(Year)

suryaa30
Creator II
Creator II

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

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

replace above variables with below

filter_ThisYear = max(Year)

filter_PriorYear = max(Year)-1

And use any of the below set of expressions.

with dollar sign expansion

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

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


without dollar sign expansion

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

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

jworthulf
Creator
Creator
Author

Sunny,

Thanks for the feedback, yes the red "wiggly" line was my concern so thanks for the feedback.

jworthulf
Creator
Creator
Author

Surya,

Thank you too.   I updated the filters & tried your first option w/ the dollar sign expansion, but unfortunately it didn't work.   I'm very new to Qlikview so I'm sure there maybe some things I'm overlooking w/ some of the other expressions that were part of the practice session I was working on.  

Not applicable

Hi John,

I'm learning from the same book and had a similar issue to yours. In my case I had a typo in one of the expressions of the chart, but after spotting it everything worked. (and I was using the exact same expressions that the book provided so it should be OK).

I suggest double checking your expressions, and make sure you are enclosing everything and you don't have additional brackets or characters lying around in the expression. The hardest part here is what others have already mentioned, when you are using set expressions the expression editor goes mad with the red underlining.

Here are my expressions and variables:

Change in sales:

sum

({$<$(filter_ThisYear)>} [# Amount]) /

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

Change in Discount %

sum

({$<$(filter_ThisYear)>} [# Amount - Discounts]) /

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

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

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

Current Year Sales

sum(

sum({$<$(filter_ThisYear)>} [# Amount])

filter_ThisYear:

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

filter_PriorYear:

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