Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
somenathroy
Creator III
Creator III

AND/OR operation in Parameterized Set Analysis

Hi,

Have created a variable as:

vParam=Sum({<$1,$2,$3>+<$4,$5,$6>} Sales_Vol)

Now in one of a chart object, would like to use this variable by passing 1st, 2nd parameter with first set and 4th parameter with second set.

For an example, like to show sales volume of current year having active_ flag = 1 OR sales of last year.

How is to pass these parameters while using in chart expression ?

I am using an work around as:

$(vParam(CY={1},active_flag={1},active_flag={1},LY={1}))

To place LY={1} in appropriate set, I am using active_flag={1} twice.


Is there any other better approach? If the number of parameters are high, this approach would not be useful.


Thanks,

som

4 Replies
somenathroy
Creator III
Creator III
Author

The below syntax is also working for QV 11.


$(vParam(CY={1},active_flag={1},$3,LY={1}))

marcus_sommer

There maybe use-cases where such parametrized variables have a benefit but as a more general approach it's just dividing the work to two places without reducing the complexity. Rather the opposite will be happens - the readability will be poorer and you get problems if you want to use multiple values or expressions within your parameters.

Therefore I would probably just use "simple" expressions which contain all of the conditions.

- Marcus

somenathroy
Creator III
Creator III
Author

Hi Marcus,

Thanks for your reply. Yes I am agree with you of using simple expressions.

But for some business scenarios I am trying to generalize a list of expressions that can be used in multiple dashboard apps. In such use-cases just trying to incorporate the common business requirements.

Not only the readability of the expressions, but also the performance hit needs to be checked.

Regards,

som

marcus_sommer

In this case it might be more useful to maintain the variables with their expression-content externally maybe within Excel. Within this posting: Variables are several links how this could be done.

From a performance point of view there is no difference if an expression is directly written or if variables contain the expressions (unless the expressions are slightly different - beginning with an equal sign or not, different number of spaces or brakets and so on are creating a different hash of the expressions and they couldn't be cached together).

- Marcus