Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
crystles
Partner - Creator III
Partner - Creator III

Storing the entire Set Analysis of expression inside a variable

I have a document where I need to reuse a certain set analysis numerous times in certain text boxes.

Every time I update the data model, or want to make a change, I have to make the set analysis change in over 30+ different text boxes. So instead of doing that, I would like to store the set analysis inside a variable and just call it in the formula.

I would just type the entire formula into the variable, but I am using this set analysis on different fields to get different results.

I have a solution (or so I thought) but even though the Text box is displaying the correct information, the Edit Expression box is telling me, "Errors in expression". So I'm afraid to use this solution, if it might break or is incorrect in some way.

See variable and formula in text box below.

Text Box

=Sum({$<$(vAAP_CV_D)>} UNIT_PLANNED)

Variable (as seen from the Variable Overview)

Variable Name: vAAP_CV_D

Variable Expression: AAP_FY={2017},BODY_TYPE={'CV'}, FUEL_TYPE={'DIESEL'}

3 Replies
swuehl
MVP
MVP

I wouldn't worry about the error message in the expression dialog, the syntax checker is not smart enough to evaluate the expanded variable in your set analysis.

Does your expression return a value? A correct value?

crystles
Partner - Creator III
Partner - Creator III
Author

Yes, I do get the correct values, but I haven't tried it on the production environment yet, and I wanted to make sure that it would work there too.

As long as it's a valide formula and it's just that the Syntax Checker doesn't like it, then I'm guessing it should be fine in production?

swuehl
MVP
MVP

Correct, as long as the variable and the expressions are set up correctly (this needs to be verified of course), you should be fine.

As a general rule, the syntax checker is only checking some syntax rules (and is not doing this perfectly) and may give you some hints, but you shouldn't take the returned result (or the red wiggly line indicating an error) as truth.

It's just not perfect.