Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to calculate the difference in the last two columns of crosstab varying number of columns

Status
Not open for further replies.

debq

Technical User
Aug 7, 2008
50
US
I have created a Crystal Reports Cross-Tab that calculates number of accounts per account class as rows and months per column along with other calculations. A total of 6 summarized columns per month. This is a very general overview of the cross-tab


January February March Difference Mar -Feb
(Count) (count) (count) (Calculated member)
Emergency 150 300 200 100
Inpatient 75 30 100 70
Outpatient 250 75 65 10

My report allows my users to select the months for the report. How can write the Insertion Formula to enter the Difference column after the last month column AND calculate the difference between those months. The issue is that the user may select a variety of number of months so my columns will change depending on the parameter value.
The user may only want to see January thru April along with the difference between March and April as the last column.

Any help would be greatly appreciated.
 
Do you need a total column? If not you could use the display string property of the Total cells to calculate and display the difference you want instead of the totals.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Hi Ken,

Thanks so much for your reply.

My report has grown and become more complex.

I still have the one row (Account Class) and one column (Admit month).

I have a total of 6 summarized fields.

I have a calculated member with the following Insertion formula:

CurrentColumnIndex=5

The "Difference"column is set to add a column after the "Admit Month" group level.

Each summarized field has a total in the bottom row.

This set up works only if my users select a the right number of months.

So the "Difference" column would need a variable to know if the user wants to review 12 months of data or just 2 or 3 months of data.

So the "Difference"column would float depending on the parameter selected.

I have added a snapshot of my layout and a snapshot of the excel that I am basing my CR report on.

Thank you for any help or guidance you can provide.
 
 http://files.engineering.com/getfile.aspx?folder=7a0bb19f-7395-46b7-893e-4524f7e3ac46&file=Excel_sample.PNG
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top