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: 
stark___
Contributor III
Contributor III

Problem with SUM

Hello.

Can you help me to write this expression "sum({$<Scenario={'Control budget '&Year&' (by the quarter)'}>} Sales)", correctly?

The main term is when I select the Year (for example: 2014), it inserted in the expression and Scenario should get 'Control budget 2014 (by the quarter)' and  expression return total "Control budget 2014 (by the quarter)" sales, when I select "2013" it return total "Control budget 2013 (by the quarter)" sales.

Thanks for your help, Stark

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Define a variable and use that in the expression, like:

Variable1='Control budget  '&GetFieldSelections(Year)&' (by the quarter)'

Expression:

sum({$<Scenario={'$(Variable1)'}>}Sales)

View solution in original post

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Try This


sum({$<Scenario={'$("Control budget" & GetFieldSelections(Year) & " (by the quarter))"}

stark___
Contributor III
Contributor III
Author

Hi, Alessandro.

I try to use your advise, but unfortunately it doesn't work.

Can you see my attached sample, maybe I do something wrong?

Best regards, Stark

tresesco
MVP
MVP

Define a variable and use that in the expression, like:

Variable1='Control budget  '&GetFieldSelections(Year)&' (by the quarter)'

Expression:

sum({$<Scenario={'$(Variable1)'}>}Sales)

arjunkrishnan
Partner - Creator II
Partner - Creator II

Hai Frd Try This One

GetFieldSelections(Scenario)&chr(10)&sum(Sales)

Result Like That

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This will work as long as there is a single selected or possible value of Year:

=sum({$<Scenario={"$(='Control budget ' &Year & ' (by the quarter)')"}>} Sales)


HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
stark___
Contributor III
Contributor III
Author

Thank you, Tresesco.

This is exactly what I need.

Best regards, Stark.

stark___
Contributor III
Contributor III
Author

Thank you, Jonathan.

Your expression works perfect.

Best regards, Stark.