Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 664
  • Last Modified:

Crystal Reports: Date range modification for exact week day for Mon - Sun

Experts,

I have a formula that gives me the date range for each week.  Weeks are considered as Monday through Sunday.  What I am trying to fix is when I run a report for LAST MONTH (November), the first week date range will begin on 10/28 to 11/03, which is Monday to Sunday.  I am trying to get it to show 11/01 to 11/03.  

Here is my current formula:

local datetimevar start;
local datetimevar end;
start:= {REPORTING_DATE}-weekday({REPORTING_DATE},2)+1;
End:=start+6;
totext(start,"MM/dd") & chr(10)&"to" & chr(10)&  totext(end, "MM/dd")


Thank you!
0
Maliki Hassani
Asked:
Maliki Hassani
1 Solution
 
mlmccCommented:
When do you want to change the start date of a week?

How are you selecting the data?
Are you selecting the data in last month or is there some other formula?

What about the last week of the month?

If you want to show the first week of a month as always starting on the first it can be done by

If (Month(WeekStart) <> Month(WeekEnd) then
   Start := Date(Year(WeekEnd),Month(WeekEnd),1)


mlmcc
0
 
Maliki HassaniAuthor Commented:
That works, I made a formula for the weekstart and weekend.

thanks
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now