COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: gdunster on 06 Sep 2013 04:31:46 PM

Title: YTD Average Sales
Post by: gdunster on 06 Sep 2013 04:31:46 PM
I need to calculate the YTD average sales in a list report.  I can sum all the sales YTD but then need to divide them by the number of days in the year as of current date.  Example today is Sept. 6, 2013, this is the 248 calendar day of the year and tomorrow it the 249th day.  How do I get this variable into my calculation within the list report? 

I can get the number of days of the year from the date dimension/table but when I add it to the rows of data it duplicates big time the number of rows.  If I create two seperate queries and join them by product it still duplicates the rows.
Any recommendations?   Garry
Title: Re: YTD Average Sales
Post by: blom0344 on 07 Sep 2013 03:06:11 PM
_day_of_year(current_date) yields the value you need as an integer. Use it within a calculation

Title: Re: YTD Average Sales
Post by: gdunster on 09 Sep 2013 01:27:05 PM
Thank you that did work.