Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

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

2 Replies
Not applicable

Re: Using an expression within an expression with set analysis

Hi ,

Hope this will helps you .

All the best . Happy Learning .

Not applicable

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.