2 Replies Latest reply: Aug 12, 2014 3:31 AM by Gullik Vetvik Killie

# Using an expression within an expression with set analysis

Hi

I have an expression that calculates the sum of sales and selects the year to be the last year.

let exprSumSales = 'sum({\$<

FactType = {\$1},

Year = {"'&Chr(36)&'(=Max(Year))"}

>} Sales)';

This is called with =\$(exprSumSales(Accounting)) and =\$(exprSumSales(Budget)) in a straight table to find the sum of sales and the sum of budgets

Then I want to make an expression that calculates the difference between one type of sales and another one.

let exprDiffSales = 'exprSumSales(\$1) - exprSumSales(\$2)';

When calling with the exprDiffSales(Budget, Accounting) the Max(Year) search fails and returns empty I think.

Is there a way around it must I write the whole expression in the exprDiffSales.

Gullik

• ###### Re: Using an expression within an expression with set analysis

Hi ,

Hope this will helps you .

All the best . Happy Learning .

• ###### Re: Using an expression within an expression with set analysis

That works, but then the expressions in the straight table will get quite messy, since each of them has in 4 or 5 input variables. A more complicated expression just having all the formulas in the script also works, but that is messy as well. I was hoping to get it cleaner.