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: 
richters
Partner - Contributor III
Partner - Contributor III

Using Variable for complete Set Analysis without error

Hi all,

currently I am working on a problem which a lot of people might have:

My application includes a lot of different filters for the time-dimension (Year,Quarter,Month, Week, Day, Weekday, ...).

For a year-to-date - analysis I am doing sth. like:

Sum({<Date={'>=$(vMaxDateYearBeginning)<=$(vMaxDate)'}>} Income)

My problem now is:

If users select a year (e.g. 2015), the year-to-date kpi for maxYear-1 is null because in my set analysis I have to add all the time-filters as follows:

Year=,Quarter=, ...

As these filters might get more in future, I want to create a variable called vSetAnalysisYTD, vSetAnalysisYTDLastYear,... in order to change the variable later and not every formula.

But when I use these variables in a formula, an issue is recognized by Qlikview because it looks like:

Sum({<$(vSetAnalysisYTD)>} Income)

Is there an easy way to tell Qlikview that this is a possible way (as this formula works)?

Thanks for any idea!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

The syntax checker does not expand variables and check the resulting code, so it might and will e.g. use the red squiggles to denote a problem where in fact there isn't one. I don't know a way to get around this.

Please read also

SR11 Error Handling Changes | Qlikview Cookbook

View solution in original post

7 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I'm afraid I don't understand the problem. Can you post a small qlikview document that demonstrates the problem?


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

The syntax checker does not expand variables and check the resulting code, so it might and will e.g. use the red squiggles to denote a problem where in fact there isn't one. I don't know a way to get around this.

Please read also

SR11 Error Handling Changes | Qlikview Cookbook

richters
Partner - Contributor III
Partner - Contributor III
Author

Hi,

here is a very simple application. The editor in the textbox shows a mistake where actually there is non. Is there any solution (create the variable on another way,...)?

Problem is that I am not really able to check complicated formulas if I write them like this.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Ah, that. Well, Stefan answered your question above. The syntax editor doesn't resolve the expansion of the variables. That's often not possible since the variables will only get 'real' values at run time.


talk is cheap, supply exceeds demand
richters
Partner - Contributor III
Partner - Contributor III
Author

No, the only problem is to check long formulas if they are really incorrect. Any solution for this?

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Test, test and test. First hardcode your set modifiers and test your set analysis expressions. Then use variables with hardcoded variables and test your expressions. Then test the expressions in your variables to make sure the variables with get the correct values. As said, the syntax checker cannot resolve dollar expension of the variables.


talk is cheap, supply exceeds demand
richters
Partner - Contributor III
Partner - Contributor III
Author

That's what I expected and "feared". Thanks!