Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
canmarroig
Partner - Creator
Partner - Creator

Variables in set analysis

I have calculated a variable to calculate vC=A/B, now i need to apply this variable inside different tables using set analysis to refine data.

I've some troubles in sintax like:

=sum({$<COLOR={yellow}, YEAR={2011}>}$(vC)).

Where am I mistaking?

Thank you

Can

3 Replies
Not applicable

My idea is:

=SUM({$<COLOR = {"yellow"},YEAR = {2011}>}$(vC))

If your values aren't numeric you need to put them in a double quote sign.

Hope this helps

Not applicable

isnt it single quotes for literals?

btw Can, could it be that you entered a = in the beginning of your variable definition? You should omit that.

IAMDV
Luminary Alumni
Luminary Alumni

Hi Can,

There are two ways to use variables. I mean the scope of variable changes by adding "=" & not adding "=" at the beginning of the declaration. For example if you declare a variable by pressing (Alt + Ctrl + V) - Variable Overview Window. Something like this...(attached the image)

vSales          Sum (PurchaseAmt)

vSales2         =Sum (PurchaseAmt)

Both of them looks very similar but they behave differently within QV. I mean vSales works as dollar sign expansion and vSales2 is calculated at the document level and then the value is sent to the object. However, when you are using vSales then the variable is evaluated for every dimension within your object.

In your case, I am assuming that you are using dollar sign expansion (Like vSales in above example). Then you need the below expression.

=sum({$<COLOR={yellow}, YEAR={2011}>} $(=($(vC))))

If this does not work, then please can you post the sample QV document?

Thanks - DV

VariableOveriew.png