COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: b737 on 05 Mar 2015 12:59:33 PM

Title: Week, Month to date, Year to date on one report
Post by: b737 on 05 Mar 2015 12:59:33 PM
Hi,

I have to create one report, where report is scheduled to run every Saturday, and to give back 4 columns. One column is 7 days (week back) from that Saturday, then Month to date (to Saturday) and Year to date (to that Saturday).

In example, for next Saturday which is 07.03.2015 I need to do

week to date                28.02 - 06.03.2015
month to date               01.03-06.03.2015
30 days to date            05.02-06.03.2015
year to date                  01.01.-06.03.2015

And than on next Saturday 14.03.2015

week to date                07.03 - 13.03.2015
month to date               01.03-13.03.2015
..........

How to do this on the same report for current and previous year

Thanks
Title: Re: Week, Month to date, Year to date on one report
Post by: charlopo on 05 Mar 2015 02:41:09 PM
It really depends what you're trying to do with your data, but you could define some data items in your query for each time period using the _days_between() function.

For example, if you were trying to do a count of how many parts were made for each time period, you could define data items like:
COUNT(IF _days_between(current_date, [DATE]) = 7) THEN ([QTY_MADE]) ELSE null)

And similarly defining the other time periods.

Alternatively, you could create a separate query for each time period, and create a filter on your date. Then, you could use a Singleton (from the Toolbox on your report page) for each time period.

Please provide more details if I've missed the point.
Title: Re: Week, Month to date, Year to date on one report
Post by: b737 on 06 Mar 2015 02:01:32 AM
Thank you for fast replay.

I have report, where measure is [Sold_products] by City in rows and data items for periods. I have attached example. Also I am working in DMR