Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
dpietersz
Creator
Creator

Manage frequently used expressions in script editor

I have the following code in my script:

SET eYTD = 'sum({$<Year = {$(=max(Year))}, Month = {"<=$(=max({<Year={$(=max(Year))}>} Month))"}>} LineSalesAmount)';


I want to use "eYTD" in my charts as an expression. But after a reload the content of "eYTD" is:

sum({$<Year = {(internal error)}, Month = {"<=(internal error)"}>} LineSalesAmount)


Any suggestion?

1 Solution

Accepted Solutions
Not applicable

First, you want to use Let instead of Set. Then in your expressions, replace all of the dollar signs with:

' & Chr(36) & '


So:

LET eYTD = 'sum({' & Chr(36) & '<Year = {' & Chr(36) & '(=max(Year))},
Month = {"<=' & Chr(36) & '(=max({<Year={' & Chr(36) & '(=max(Year))}>} Month))"}>} LineSalesAmount)';


Then once you reload, QlikView will put in the dollar signs, but not evaluate the dollar sign expansion. Your variable should contain the Set Analysis expression and it should work in your charts.

View solution in original post

3 Replies
Not applicable

First, you want to use Let instead of Set. Then in your expressions, replace all of the dollar signs with:

' & Chr(36) & '


So:

LET eYTD = 'sum({' & Chr(36) & '<Year = {' & Chr(36) & '(=max(Year))},
Month = {"<=' & Chr(36) & '(=max({<Year={' & Chr(36) & '(=max(Year))}>} Month))"}>} LineSalesAmount)';


Then once you reload, QlikView will put in the dollar signs, but not evaluate the dollar sign expansion. Your variable should contain the Set Analysis expression and it should work in your charts.

dpietersz
Creator
Creator
Author

It worked.

Thx NMiller!

udaya_kumar
Specialist
Specialist

Hi Dimitri and NMiller,

How you have used the eYTD field in your expressions in chart?

I used it like

I gave just =eYTD in the expression in the chart,

the table is showing the whole expression instead of evaluating that expression.

so how to use that eYTD in expression in chart?

Can you please help me?