?
Solved

Calculating 13 weeks prior to a date.

Posted on 2011-10-27
3
Medium Priority
?
319 Views
Last Modified: 2012-05-12
I have a payroll report with a period end date.  I want to display this date and 13 weeks of payroll data from this date to show 13 payroll weeks of data.  How or what method is best to calculate weeks in Crystal Reports?
0
Comment
Question by:garyjgs
3 Comments
 
LVL 1

Assisted Solution

by:SarekOfVulcan
SarekOfVulcan earned 800 total points
ID: 37041643
Does DateAdd("ww", -13, {?StartDate}) work for you?
0
 
LVL 26

Accepted Solution

by:
Kurt Reinhardt earned 1200 total points
ID: 37043056
Your question is a little broad.  Are you asking how to filter the report for the specified date range or how to format the report once you have data (1 column, per payroll week, for example), or both?

For filtering data, you might be able to use some variation of :

{table.date} in DateAdd("ww", -13, {?StartDate}) to {?StartDate}

For formatting, you might be able to get away with a crosstab, but chances are you'll need to use formulas to create a manual crosstab. A manual crosstab is where you create a number of formulas at the detail level for each week. Each formula might be something like:

If
//calculate the date range for the 13th week using this or another formula
  {table.date} in DateAdd("ww", -13, {?StartDate}) to (DateAdd("ww", -12, {?StartDate}) - 1)
Then
  1
Else
  0

You'd then create a summary field for each detail column and suppress the detail section afterwards.  This will basically "flatten" out the various vertical records and aggregate them into a single row of data.  It's not the most efficient method, but it works well.
0
 

Author Closing Comment

by:garyjgs
ID: 37045311
On the money.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

807 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