Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Author

Hi ,

Hope this will helps you .

All the best . Happy Learning .

Not applicable
Author

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.