# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

## Expression Sum with a sum variable

Hi

I’m having problems with the below expression.

I have not made any selections in dimension other what is in this expression.

=sum({\$<Calendar_YearAndMonth={'201401','201402','201403','201404'}>}\$(vCO_POSIBLE_TURNOVER))

The varible “vCO_POSIBLE_TURNOVER” is

(sum(\$(vCO_NET_AMOUNT_EUR))+(sum(\$(vCOINVO_NET_AMOUNT_EUR))))

And this variable works outside this expression.

1 Solution

Accepted Solutions
Not applicable

## Re: Expression Sum with a sum variable

Hi Michael,  Please use set Analysis also in the the variable :

LET vCO_POSIBLE_TURNOVER =

(sum({\$<Calendar_YearAndMonth={'201401','201402','201403','201404'}>} \$(vCO_NET_AMOUNT_EUR))+(sum({\$<Calendar_YearAndMonth={'201401','201402','201403','201404'}>} \$(vCOINVO_NET_AMOUNT_EUR))))

6 Replies
MVP

## Re: Expression Sum with a sum variable

\$(vCO_POSIBLE_TURNOVER))

write:

\$(=\$(vCO_POSIBLE_TURNOVER)) )

Not applicable

## Re: Expression Sum with a sum variable

Michale,

Sum of sum will not work.

Modify your valriable so that it becomes A+B and not sum(A)+sum(B)

Fabrice

MVP

## Re: Expression Sum with a sum variable

Hi

You cannot nest SUMs directly; use aggr() if necessary - something like this:

sum({\$<Calendar_YearAndMonth={'201401','201402','201403','201404'}>} Aggr(\$(vCO_POSIBLE_TURNOVER), ChartDim1, ChartDim2, ...))

(where ChartDim1, ChartDim2 is a comma separated list of dimensions in your chart or table.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

## Re: Expression Sum with a sum variable

I thank you all for your help…… I have tried them but they did not succeeded, so I will keep on trying new ways to get this solved.

Br

Michael

Not applicable

## Re: Expression Sum with a sum variable

Hi Michael,  Please use set Analysis also in the the variable :

LET vCO_POSIBLE_TURNOVER =

(sum({\$<Calendar_YearAndMonth={'201401','201402','201403','201404'}>} \$(vCO_NET_AMOUNT_EUR))+(sum({\$<Calendar_YearAndMonth={'201401','201402','201403','201404'}>} \$(vCOINVO_NET_AMOUNT_EUR))))

Not applicable

## Re: Expression Sum with a sum variable

Thank you dathu.... this one worked :-)