2 Replies Latest reply: Aug 31, 2012 6:06 AM by Thomas Skariah

# Simple set analysis question

Hello all,

I have a simple Set Analysis question. I just cant get it to work and im getting nuts   See the code below:

This works!

```=sum
(
{
\$<
Year={\$(=max(Year))},
[Year Month]={\$(=num(max([Year Month])))}
>
}
VALUE
)
```

This does not work!

```=sum(
{
\$<
Year=,
[Year Month]={"\$(=max([Year Month]-1))"}
>
}
VALUE
)
```

Im trying to compare a value with the value last month. Could anyone give me a suggestion for how to do this?

The field [Year Month] has the value = "200101".

Br

c

• ###### Re: Simple set analysis question

Hi,

You [Year Month] field has the value = "200101", when you subtract -1 then you get 200100, 0th month, this(200100) does not exists in your month field, so your expression is not returning any results.

If you have a date field then you can try this

`=sum({    \$<    Year=,    [Year Month]={"\$(=Date(Addmonths(max(DateField), -1)), 'YYYYMM')"}        >}VALUE)`

Hope this helps you.

Regards,

Jagan.

• ###### Re: Simple set analysis question

Hi Cristain,

You can get an idea from the below attached application.

Regards,

Tom