6 Replies Latest reply: Oct 6, 2016 11:58 AM by Sunny Talwar

# Problem Operation with Variables

Hi;

I have a problem with the calcul of two variables in a chart:

V1= Sum({<Linea={"1"}, Codes={"*"}-{"1","20","24","31"}>} Quantity)/60

V2=Count (distinct {<Linea={"1"},Codes={"*"}>}Clave)-Sum ({<Linea={"1"},Codes={"1","20","24","31"}>} Quantity/60)/480

When I calcul in one expresion in a chart:

\$((V1)/(\$(V2)*480)

the memory is exceded in the chart.

The problem is the operation with 480.

When I take out 480, the expression calcul something.

I am interested to make work the expression.

Please, one solution...

• ###### Re: Problem Operation with Variables

May be remove this parenthesis -> \$((V1)/(\$(V2)*480)

\$(V1)/(\$(V2)*480)

• ###### Re: Problem Operation with Variables

Sorry, it does not work.

• ###### Re: Problem Operation with Variables

Do you mean with it doesn't work that the result isn't like you expected it or that you yet get an error-messages? I think you should be more explicit by declaring the variables to ensure that your calculations happens in the right order. I mean something like this:

V1:

(Sum({<Linea={"1"}, Codes={"*"}-{"1","20","24","31"}>} Quantity)/60)

V2:

(Count (distinct {<Linea={"1"},Codes={"*"}>}Clave)-(Sum ({<Linea={"1"},Codes={"1","20","24","31"}>} Quantity/60)/480))

and then use these variable-calculations within a table-chart without an expression-name so that you could see within the expression-label how the variables will be evaluated (in cases of memory exceeded reduce the dataset by removing dimensions and selecting to a quite granular level).

- Marcus

• ###### Re: Problem Operation with Variables

Hi Marcus:

Sorry for the not clear message.

At the end the solution was other:

1/480 *\$(V1)/(\$(V2)

I don´t know why if I insert the value at the beginning of the expresion it works.

Best regards,

• ###### Re: Problem Operation with Variables

If V2 contains an expression that divides by 480, and in your final expression you multiply by 480, can't you just leave out the division/multiplication?

• ###### Re: Problem Operation with Variables