11 Replies Latest reply: May 13, 2014 4:05 AM by Stephen Naude

# Dollar Syntax

Morning,

I was wondering if anyone has an "Idiots guide to dollar syntax"?, further more if anyone has a similar "idiots guide to Set Analysis"?

Thanks

• ###### Re: Dollar Syntax

Hi,

Romancing with Set Analysis

Regards

ASHFAQ

• ###### Re: Dollar Syntax

Thanks Ashfaq,

I have read a similar document, my problem now is how to incorporate a variable into this, say for example in the following expression:

Sum({\$<Year={2008}>} Sales)

I want to replace 2008 with the max year in the set, for which i have already created a variable called vMxYear. Qlikview rejects the following:

Sum({\$<Year={vMxYear}>} Sales) and also

Sum({\$<Year={\$(vMxYear)}>} Sales)

Cheers

• ###### Re: Dollar Syntax

Hi may be like this.

Sum({\$<Year={'\$(=vMxYear)'}>} Sales)

Regards

ASHFAQ

• ###### Re: Dollar Syntax

will give it a try...thanks

• ###### Re: Dollar Syntax

Ok that works, but it only works when the particular year is selected, how do i change it so that regardless of what is selected, that calculation returns only the last Year.

Thanks for the help

• ###### Re: Dollar Syntax

Stephen

I assume that vMxYear is a variable. Define the variable

=Max(Year)

(the = sign is included in the definition, so this variable always returns the maximum possible year. The max possible year is the maximum in the data set if nothing is selected, or the maximum of the selected values if one or more year is selected.

Then use it as described previously.

HTH

Jonathan

• ###### Re: Dollar Syntax

Thanks but not working, if nothing is selected and everything is exactly as you guys told me to do, it sums everything.

• ###### Re: Dollar Syntax

Stephen

There are two possible causes:

• Year is not properly linked to the fact table in your model, so selecting year does not change the totals.
• vMaxYear is not working properly.

To check the first, verify the that the Sums or Counts change when you make a selection of Year. If necessary, add a Year list box.

To check the second, create a new chart/table, enter

Sum({\$<Year={'\$(=vMxYear)'}>} Sales)

as the expression. Do not enter an expression label. Now the table caption should display the expression without the \$ expansion and the column label should display the expression with the dollar expansion. That should give you a clue as to what's happening.

HTH

Jonathan

• ###### Re: Dollar Syntax

Thanks All,

Got it working, would help in future if i actually remembered that my Fields are not named the same :-)