?
Solved

Crystal Reports: determine date range in various weeks

Posted on 2014-07-22
2
Medium Priority
?
542 Views
Last Modified: 2014-07-22
Hello Experts,

I have a chart that list data points for each week.  The table that I am using only has a field called "reporting_year_week", which displays weeks like "2014-W27".  I need help writing a formula that will evaluate the "2014-W27" and provide the following dates range.  Here are examples:
06/09-06/15
06/16-06/22
06/23-06/29
06/30-07/06

Unfortunately, if I had a single date in the table then I would be able to use a formula like this, but I don't so I have to evaluate the "2014-W27".

local datetimevar start;
local datetimevar end;
start:= CurrentDate-weekday(CurrentDate,2)+1;
End:=start+6;
{@reporting_year_week} & chr(10)&
totext(start,"MM/dd") & "-" &  totext(end, "MM/dd")
0
Comment
Question by:Maliki Hassani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 40211864
Try this for the first day of the week

Local NumberVar myWeeks;

myWeeks := Val(Split({YourDateField},"W")[2]);

Date(DateAdd('ww',myWeeks,Date(2014,1,1)) - DayOfWeek (DateAdd('ww',myWeeks,Date(2014,1,1))) + 1)

Open in new window


Try this for the last day of the week
Local NumberVar myWeeks;

myWeeks := Val(Split({YourDateField},"W")[2]);

Date(DateAdd('ww',myWeeks,Date(2014,1,1)) - DayOfWeek (DateAdd('ww',myWeeks,Date(2014,1,1))) + 1) + 6

Open in new window


mlmcc
0
 

Author Comment

by:Maliki Hassani
ID: 40211885
That works!  Thanks mlmcc!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question