cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Cross-tab

Former Member
0 Kudos

Hello everyone...

Here is some quick background info on my project:

1) I am attempting to write a Crystal Report (version 10) to automatically capture crime statistics for a previous time period based on a current time period entered into the Crystal Report parameter. The current date range to automatically be captured is the previous seven weeks. For example, if a user enters the date range of June 15, 2008 - August 2, 2008, the Crystal Report will automatically gather data for the two date ranges of April 27, 2008 - June 14, 2008 (the previous date range) and June 15, 2008 - August 2, 2008 (the current date range). The purpose of this is to automatically gather crime statistics for two equal date ranges to compare crime rates.

2) I have been able to successfully construct a formula to gather the previous date range.

3) I have constructed a cross-tab but I am having difficulties formatting the cross-tab to display data as I desire.

With the background of my project now described I will move into the main problem I am experiencing. I am able to display the data for all the necessary weeks in the cross-tab; using the same date range above I am able to show data for the fourteen weeks of April 27, 2008 - August 2, 2008. However, I wish to have a single cross-tab display the grand totals for just the previous date range while having weekly totals and a grand total for the current date range.

Using the same date ranges above as an example, the date range of April 27, 2008 - June 14, 2008 will show just the grand totals for all seven weeks of that period. Conversely, I would like to have the date range of June 15, 2008 - August 2, 2008 show weekly totals as well as grand totals for all seven weeks of that period.

I would like to keep all this data in a single cross-tab due to having to put the data in another crime analysis report.

Any help you can provide is most appreciated...let me know if I can provide further info. Just so you know I am a bit of a beginner when it comes to Crystal Reports.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello, you might try this:

1) Create a formula field in your details section with this:

Whileprintingrecords;

If (table.date >= "start date of your pre-date range" and

table.date <= "end date of your pre-date range") then 'Pre-Date'

else

if (table.date >= "your 1st week start" and table.date <= "your 1st week end") then 'Week 1'

else (if table.date >= "your 2nd week start" and table.date <= "your 2nd week end") then 'Week 2'

else .... for the 7 weeks you want a separate column.

2) create the cross-tab and put the formula field as the column.

3) I believe if you right-click on the total field to the far right and "Format Field" you can use the "Display String" option to delete the sum of the previous week's from the CurrentFieldValue and use the TOTEXT() function to display it. This will only display the sum of your current 7 weeks.

You may want to go change the "Group Options" for the column to Sort in "Specified Order" and create named groups for each of your column headings. I can explain how you would do this if you need it.

Answers (0)