4 Replies Latest reply: Jul 31, 2012 5:14 AM by Goran Korsgren

# Syntax for using a variable into Set Analysis

Hi,

Please can somebody explain the difference between the following two statements:

I tried to use a variable to calculate the previous months sales (based on MONTH Number.

However the following expression is bringing back ALL MONTHS before the current month....

sum({<CalendarMonthName =, CalendarMonthNumber = {'<= \$(=v_Previous_Month)'}>} Sales)

So after trial and error this expression works........ (brings back only the previous month)

Sum({<CalendarMonthName=, CalendarMonthNumber={'\$(v_Previous_Month)'}>} Sales)

Does anybody have an insight into the difference between the above expressions?

• ###### Re: Syntax for using a variable into Set Analysis

Hi

use this expression

Sum({<CalendarMonthName=, CalendarMonthNumber={'\$(=v_Previous_Month)'}>} Sales)

Regards

Perumal

• ###### Re: Syntax for using a variable into Set Analysis

Try with the following expression:

Sum({<CalendarMonthName=, CalendarMonthNumber={'\$(=v_Previous_Month)'}>} Sales)

Or

Sum({<CalendarMonthName=, CalendarMonthNumber={"=\$(v_Previous_Month)"}>} Sales)

• ###### Re: Syntax for using a variable into Set Analysis

I think the question was stated badly ... (or has been mis-read)....

I found the solution but would like some explanation as to why the second expression works over the first one - which doesnt.

• ###### Re: Syntax for using a variable into Set Analysis

In the first expression you have <= before the "previous month number".

That is like manually entering <= in the search box for a field - You will get all months less than or equal what you enter after the <=.

In the second expression you do not have anything before the "previous month number".

That is like manually entering just a month number in the search box for "month number" field - you will get that month.