COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: BigOCombe on 08 Apr 2013 08:41:37 AM

Title: Last Four Weeks of Sales
Post by: BigOCombe on 08 Apr 2013 08:41:37 AM
Hello Community,

I am really new to Cognos and I am hoping to get some help here.

What I am needing to do is sum the last 4 weeks of sales. So if I run the report today, I want a column that would show the last four weeks of sales.

Thanks!
Title: Re: Last Four Weeks of Sales
Post by: wyconian on 08 Apr 2013 09:51:25 AM
Hi weeks is a little difficult.  There are built in functions that can do this for days or months.  Take a look at _add_days() or _add_months() which you can find in the list of date functions.  They are designed to add days but if you put in anegative figure they will subtract days.

So you could have a filter like _add_days(sales_date,-28) 0r _add_months(sales_date,-1), that should give you sales for the last 28 days (4 weeks) or for the previous month.  You can then just total the sales as normal.

Hope that helps :-)