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: 
wgonzalez
Partner - Creator
Partner - Creator

Replacing an expresion with a Expansion using Variable

Hi,

I want to replace this long expresion NetWorkDays(MonthStart(min(DTPunchDate)),MonthEnd(max(DTPunchDate))))

with an Expansion Variable.  The intention is to simplify the expresion in the chart.

Have anyone done this before?  How?

Thanks,

Wilfredo.

1 Solution

Accepted Solutions
wgonzalez
Partner - Creator
Partner - Creator
Author

Nice!  It worked, Thanks!

View solution in original post

2 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Yes, simply create th variable and store the formula there as a text. If you decide to use it in the load script, use SET statement rather than LET.

Then, in the chart, simply recall the variable using $-sign expansion:

SET vFormula ='NetWorkDays(MonthStart(min(DTPunchDate)),MonthEnd(max(DTPunchDate))))';

Expression:

$(vFormula)

cheers,

Oleg

wgonzalez
Partner - Creator
Partner - Creator
Author

Nice!  It worked, Thanks!