Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

New Contributor III

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


Tags (2)
3 Replies
Not applicable

Variables in set analysis

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

Variables in set analysis

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.

Honored Contributor II

Re: Variables in set analysis

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


Community Browser