{DateField}
in Minimum( WeekToDateFromSun) + 1 to
Maximum( WeekToDateFromSun) + 1
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
Ok so at first glance I thought Ken's formula would do the trick, but I've run into a problem.
Our weeks run Monday to Sunday and we sell 7 days a week.
At the close of business on Sunday I want to accumulate sales for the past week (WeekToDateFromMonday).
Ken, your formula works well Monday to Saturday, but on Sunday nothing shows up.
I believe that because it is “Sunday” the formula is evaluating week 2, not week 1.
Is this making any sense? Your comments would be appreciated.
Sorry about that. I thought there would be a more elegant way, but I couldn't break the calendar week without an if statement. The following should work:
if DayOfWeek(currentDate) = 1
then
{Orders.Order Date} in
CurrentDate - Dayofweek(CurrentDate) - 5 to
CurrentDate - Dayofweek(CurrentDate) + 1
Else
{Orders.Order Date} in
CurrentDate - Dayofweek(CurrentDate)+ 2 to
CurrentDate - Dayofweek(CurrentDate) + 8
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
This is what I came up with, I created a formula @ThisWeek,
beforereadingrecords;
select DayOfWeek (CurrentDate)
case 1: CurrentDate-6
case 2: CurrentDate
case 3: CurrentDate-1
case 4: CurrentDate-2
case 5: CurrentDate-3
case 6: CurrentDate-4
case 7: CurrentDate-5
Then in the Select Expert,
{Datefield}>={@ThisWeek}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.