11 Replies Latest reply: Sep 13, 2017 10:24 AM by Anil Samineni

# how to write expression

Hello All,

For 201706 i need to show sum of volume from 201704 to 201705 only which is -700-200+700+1700-1700+2200==2000 so i need to 2000

please suggest how to write a expression to achieve above requirement

thanks

• ###### Re: how to write expression

May be this?

Sum({<CALMONTH = {'201704','201705'}>} VOLUME)

Or

Sum({<CALMONTH = {">=\$(=Max(CALMONTH)-2) <\$(=Max(CALMONTH))"}>} VOLUME)

• ###### Re: how to write expression

Sorry i think, i haven't  clearly explain this requirement

what if  201710 is selected

then i need to show volume from   201704 to 201709

• ###### Re: how to write expression

That mean you only need current month of data? May be this?

Sum({<CALMONTH = {">=\$(=YearStart(Max(CALMONTH))) <\$(=Max(CALMONTH))"}>} VOLUME)

• ###### Re: how to write expression

Sum({<CALMONTH = {">=\$(=YearStart(Max(CALMONTH))) <\$(=Max(CALMONTH))"}>} VOLUME)

the above expression is working bang on but only one thing is if i am have from 201701 to 201708

and for 201709 i need to show  sum of volume from 201704 to 201708  but now it is showing sum of volume from 201701 to 201708 .....

how to get sum of volume from  201704 to 201708

• ###### Re: how to write expression

Is your fiscal year starting from April? If not you can manipulate to work.. Or else i believe you have to declare static only

• ###### Re: how to write expression

Only for 201706? What about other CALMONTH?

• ###### Re: how to write expression

currently i need to show only 201706 but it has to be dynamic what i mean what i mean is

for 201710 i need to show sum of volume from 201704 to 201709

• ###### Re: how to write expression

It is dynamic or hardcoded value let me know.

• ###### Re: how to write expression

currently i need to show only 201706 but it has to be dynamic what i mean what i mean is

for 201710 i need to show sum of volume from 201704 to 201709

• ###### Re: how to write expression

For 201710 May Be it is 201708 to 201709

Try this it is dynamic and based on selection as well

Sum({<CALMONTH = {">=\$(=Date( Addmonths(Max(CALMONTH),-2 ),'YYYYMM' ) <\$(=(Max(CALMONTH))"}>} VOLUME)

• ###### Re: how to write expression

And may be this

Sum({<CALMONTH = {">=\$(=Date( Addmonths(Max(CALMONTH),-2 ),'YYYYMM' )

<\$(=(Date(Max(CALMONTH),'YYYYMM')"}>} VOLUME)