9 Replies Latest reply: Jan 9, 2013 4:41 AM by barnabe42

# Can't make =Only([YEAR]-1) working in the expression definition

I am trying to display the cumulative sales for the current and previous year

In the label the expression "=Only([YEAR]-1)" seems to works correclty as show in the screenshot

But I can't make the expression "=sum( {\$<Year = {\$(=Only([YEAR]-1))}>} AMOUNT ) " working, it always evaluate the current year.

Am I doing anything wrong ?

/Eric

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

Try and move the "-1" out of the only function like this

"=sum( {\$<Year = {\$(=Only([YEAR])-1)}>} AMOUNT ) "

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

HI ,

Try this Expression.

Current Year Sales:

sum({<Year= {"\$(=Max(Year))"}>} AMOUNT )

Last Year Sales:

Sum({<Year = {"\$(=Max(Year )-1)"}, Quarter=, Year=>} AMOUNT )

Regards,

Nirav Bhimani

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

The max year did not solve the problem, could it be that my data is corrupted ?

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

Hi,

Both expressions will work. Can u share a demo file so that I can help you.

Regards,

Nirav Bhimani

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

Hi,

That did not change anything

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

Hi

sum({<YEAR={\$(=only(YEAR)-1)}>}[Net Amount])

it show values only when u select the year

otherwise it show all 0,s

u must select the one year for it

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

I ahve a list box property where I select the [YEAR] attribute.

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

Hi

u select the year in ur  year field what ur using in the expression

sum({<YEAR={\$(=only(YEAR)-1)}>}[Net Amount])

• ###### Re: Can't make =Only([YEAR]-1) working in the expression definition

Thanks a lot, I add one characters \$ that was not needed