Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
prabhu0505
Specialist
Specialist

Reusing Aggr function

Is there any way I can reuse the aggr function especially it's virtual table?

Say for instance, below expression which i thought of re-using is part of almost all of my final expressions.

aggr(sum(A/B), Dim1)

Final Expressions:

aggr(sum(A/B), Dim1) - Sum(D)

aggr(sum(A/B), Dim1)/Sum(E)

aggr(sum(A/B), Dim1)*100

and many..

So by any chance I could reuse the virtual table created by one Aggr function to all of my final expressions?

4 Replies
tresesco
MVP
MVP

Say your first expression: =aggr(sum(A/B), Dim1)  and label it as 'AAA'

then you can refer this expression in following expressions like:

=AAA-Sum(D)

=AAA/Sum(E)

Or,

=Column(1)/Sum(D)           // column(N), 'N' is the expression column position which you refer

Or, even you can define a variable for the expression and refer it wherever you need it.

Clever_Anjos
Employee
Employee

Create a variable using your constant expression and use it

aggr(sum(A/B), Dim1)

Please refer to http://community.qlik.com/blogs/qlikviewdesignblog/2013/11/04/the-magic-of-variables

prabhu0505
Specialist
Specialist
Author

Thanks for the response..

I've read a post by Barry regarding labeling and using variable instead of

direct expression but he concluded saying neither of them posses attractive

performance benefit.

Currently Im in a situation where one of chart is taking almost 10 mins to

load, I've get of rid of it.

tresesco
MVP
MVP

The more you use AGGR and such complex expressions in the UI, your UI performance would suffer. You can't hold the calculated values(apart from single value in a variable) in UI. Therefore, to get rid of it, you might have to contemplate on bringing some calculations in the script.