Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can I SET or LET a variable to include a $(=...)

I want my variable, vPop, to look like this:

SUM({$<Year={$(=MAX(Year))}>}Population)

Notice the part in bold.

See in attached ; open the variable view

Can I do this in SET or LET in the Load Script

When I try this:

SET vPop = SUM({$<Year={$(=MAX(Year))}>}Population);

After reloading, the value of vPop is this:

SUM({$<Year={}>}Population)

And therefore $(vPop) evaluates to 0

I managed to do it by separating "$"  from the "("  and concatenating them together -- but it's ugly.

11 Replies
Not applicable
Author

Oooh, another clever suggestion, I didn't think of that.

I really like it because I can

  • Maintain variables in plain text (all of these answers support that  (a QVS supports that)-- but swuehl's suggestion forces you to separate variable definitions from other LOAD -- for better or worse [I think it's for better])
  • I can use dollar-signs without "workarounds" like substitution or string concatenation. Therefore my variable is uninterrupted and easier to read and write.
  • AND bonus: I could edit it in Excel or some CSV editor so I get the look-and-feel of the variable UI in Qlikview (Ctrl+Alt+V), and the advantage of extra columns (i.e. a "Comment" column)

But you said:

Doing so, you can use dollar sign expansions etc. in your excel columns with the need for a special treatment


Did you mean:

without the need for special treatment


swuehl
MVP
MVP

Yes!