Total Average Week using a Parameter

Posted by Jose on Stack Overflow See other posts from Stack Overflow or by Jose
Published on 2010-06-17T14:16:13Z Indexed on 2010/06/17 14:53 UTC
Read the original article Hit count: 226

Filed under:
|

I have a crystal report that shows sales volumes called week to date volume. It shows current week, previous week, and average week. The report prompts for a date parameter and I extract the week number to get current week and previous week volumes. Did it this way because Mngmt wants to be able to run report whenever. My problem is for Average Week I cant figure out how to get the number of weeks to divide by for my average. Report originates from June 1st, 2010. Right now I have:

DATEPART("ww", {?date}) - DATEPART("ww", DATE(2010, 6, 1))

This returns 2 right now which is perfect, so i divide my total by 2. This code will work until the end of the year then I'm hooped. Any idea how I can make this a little more dynamic. I was thinking a counter somehow, just can't get the logic down because the date parameter will keep changing, meaning I cant increase my counter by 1 after each week???

Cheers.

© Stack Overflow or respective owner

Related posts about crystal-reports

Related posts about crystal