Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

stark___
New 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
MVP
MVP

Re: Problem with SUM

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

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

Expression:

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

7 Replies

Re: Problem with SUM

Try This


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

stark___
New Contributor III

Re: Re: Problem with SUM

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

MVP
MVP

Re: Problem with SUM

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

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

Expression:

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

arjunkrishnan
Contributor

Re: Problem with SUM

Hai Frd Try This One

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

Result Like That

MVP
MVP

Re: Problem with SUM

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

stark___
New Contributor III

Re: Re: Problem with SUM

Thank you, Tresesco.

This is exactly what I need.

Best regards, Stark.

stark___
New Contributor III

Re: Re: Problem with SUM

Thank you, Jonathan.

Your expression works perfect.

Best regards, Stark.

Community Browser