Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
debabrata_sahoo
Contributor III
Contributor III

How to get previous month sales for the current year.

How to get previous month sales for the current year. In my table YEAR,MONTH,SALES are there. MONTH format is 'MMMYY'.

please help me to write set analysis for sum  of sales of previous months.

 

Thanks in advance.

1 Solution

Accepted Solutions
sunny_talwar

try this

Sum({<Month = {"$(=Date(MonthStart(Max(Month), -1), 'MMMYY'))"}>}Sales)

View solution in original post

7 Replies
arvind_patil
Partner - Specialist III
Partner - Specialist III

Create it into date and do it as follows:

Sum({<MONTH={'$(=Date#(Addmonths(Date(Date#(MONTH,'MMMYY')),-1),'MMMYY')}>}Sales)

Thanks & Regards,
Arvind Patil
sunny_talwar

I think you might need to use Inter-Record Functions here

debabrata_sahoo
Contributor III
Contributor III
Author

Hi Arvind ,

Thanks for reply but this code not working.

arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi,

 

Kindly provide me sample data so i can give you exact op.

 

Thanks & regards,

Arvind Patil

debabrata_sahoo
Contributor III
Contributor III
Author

Year      Month    Sales
2017     Sep17     300
2017     Oct17     340
2017     Nov17     345
2017     Dec17     674
2018     Jan18     235
2018     Feb18     564 

In A text object i want to display previous month Sum of sales .

it will be 235

 

sunny_talwar

try this

Sum({<Month = {"$(=Date(MonthStart(Max(Month), -1), 'MMMYY'))"}>}Sales)

debabrata_sahoo
Contributor III
Contributor III
Author

Thanks sunny. its working now.