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

how to get last 6 months data

Hello!

There is a table having 2 field one is sales field and another is date field. date field contain dates of 2011 and 2012 .

Maximum date is 16/02/2012 (dd/mm/yyyy). 2012 Feb is maximum.

The requirement is display sum of sales of last 6 month in a bar chart . It will show Feb,Jan,Dec,Nov,Oct and Sept months sum(sales).

Please help me to write a set analysis for  this.

Thanks in advance.

5 Replies
Anil_Babu_Samineni

May be look Set Analysis for Rolling Periods

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vikasdesai
Partner - Contributor III
Partner - Contributor III

Hello ,


Use following expression to display sum of sales of last 6 month

Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=MonthStart(Max(Date), -5))<=$(=Date(Max(Date)))’}>} Sales )

Regards,

Vikas

Anonymous
Not applicable

Hi,

You can use a set analysis expression to select the Date values of the last six months:

count({<Date={'>$(=AddMonths(Max(Date),-6))'}>} sales)


Thanks,

debsahoo
Contributor III
Contributor III
Author

mycode.PNG  I tried it but that red line shows and not working.

vikasdesai
Partner - Contributor III
Partner - Contributor III

Use following Expression

Sum({<Year=, Quarter=, Month=, Week=,Date={">=$(=MonthStart(Max(Date),-5)<=$(=Date(Max(Date)))"}>}Sales)