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: 
Not applicable

Variable in a Set Analysis expression

Hi,

I'd like to use a variable inside a set analysis expression. Is it possible?

I have tried to use this expression, unsuccessfully:

sum({$<Year = {$(=only(Year))}, Month = {"<=SelectedMonth"}>} DaysNumber), where SelectedMonth is a variable.

Thanks

1 Solution

Accepted Solutions
IAMDV
Luminary Alumni
Luminary Alumni

sum({$<Year = {$(=only(Year))}, Month = {$(=$(VariableName))}>>} DaysNumber).


View solution in original post

8 Replies
IAMDV
Luminary Alumni
Luminary Alumni

sum({$<Year = {$(=only(Year))}, Month = {$(=$(VariableName))}>>} DaysNumber).


IAMDV
Luminary Alumni
Luminary Alumni

Hi,

You should always use the $ sign and the brackets to expland the variable. I hope this helps... please post the QV document, if you still have problems.

IAMDV
Luminary Alumni
Luminary Alumni

Also please see the below post on variables expansion used as UDF (user defined function). I thought you might be interested...

http://community.qlik.com/forums/t/43601.aspx

Not applicable
Author

Hi, thanks.

Is it right also writing sum({$<Year = {$(=only(Year))}, Month <= {$(=$(VariableName))}>>} DaysNumber)?

I have added Month <= ... instead of Month = ...

Thanks

sushil353
Master II
Master II

yes this will work fine

Not applicable
Author

mmhhh, when I add the minor sign ( < ) in the expression editor I can see the text " <= " underlined in red. This is a mistake!

Thanks

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This is, I think, the expression you are looking for:

sum({$<Year = {$(=only(Year))}, Month = {"<=$(=$(VariableName))"}>>} DaysNumber)

or (I think the outer dollar expansion may be unnecessary) ...

sum({$<Year = {$(=only(Year))}, Month = {"<=$(VariableName)"}>>} DaysNumber)

Hope that helps
Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
IAMDV
Luminary Alumni
Luminary Alumni

Please can you post the QV document with sample data? It will be much easier to identify...