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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
aarav021
Contributor III
Contributor III

How to use any formula in load editor dynamically i.e it gets reacted when filters are applied

I am using a KPI what I need is a performance optimization for that KPI. So there is formula that is being repeated more often so is there way I can set that formula in load editor and use it dynamically in my KPI. Like when using that variable it should change when filters are applied. 

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

As an example, let's assume an expression like:

Sum({<Year-{$(=Max(Year))}>}Sales)

If you try script:

SET vSales = Sum({<Year-{$(=Max(Year))}>}Sales);

The script will attempt to evaluate Max(Year) and the variable will be incomplete.  Instead, break up the $( in your script like this:

LET vSales = 'Sum({<Year-{' & '$(=Max(Year))}>}Sales)';

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

View solution in original post

7 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can create the expression in a variable, for example in script:

SET vSales = Sum(Sales);

And then reference the variable in charts as:

$(vSales)

Note that there is some tweaking that needs to be made in the script if your expression contains $(.

-Rob

aarav021
Contributor III
Contributor III
Author

It does contain $ ..so what should be done ?

 

aarav021
Contributor III
Contributor III
Author

Please help me. I am new to Qliksense 

aarav021
Contributor III
Contributor III
Author

BrunPierre
Partner - Master II
Partner - Master II

The dollar sign expansion ($); returns the value of the variable instead of its name.

See here: Dollar-sign expansion using a variable 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

As an example, let's assume an expression like:

Sum({<Year-{$(=Max(Year))}>}Sales)

If you try script:

SET vSales = Sum({<Year-{$(=Max(Year))}>}Sales);

The script will attempt to evaluate Max(Year) and the variable will be incomplete.  Instead, break up the $( in your script like this:

LET vSales = 'Sum({<Year-{' & '$(=Max(Year))}>}Sales)';

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

aarav021
Contributor III
Contributor III
Author

@rwunderlich @BrunPierre Thank you  For helping out. . Thanks much !