8 Replies Latest reply: Apr 19, 2011 7:21 AM by Deepak Vadithala

# 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

• ###### Variable in a Set Analysis expression

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

• ###### Variable in a Set Analysis expression

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.

• ###### Variable in a Set Analysis expression

Hi, thanks.

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

Thanks

• ###### Variable in a Set Analysis expression

yes this will work fine

• ###### Variable in a Set Analysis expression

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

Thanks

• ###### Variable in a Set Analysis expression

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

• ###### Variable in a Set Analysis expression

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