views:

19

answers:

1

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.

A: 

Look into the Crystal Reports method: DateDiff.

Zamboni
To elaborate on Zamboni's suggestion, "datediff("ww",date(2010,6,1),{?date})"
PowerUser
Man you are a lifesaver. I love this site. I changed my code to DATEDIFF("ww", DATE(2010,6,1), {?date}) and it worked perfectly.
Jose
Right on thanks PowerUser..sorry i didn't see your comment, didnt refresh page!
Jose