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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab column problem

Status
Not open for further replies.

mme

Programmer
Mar 26, 2002
2
FI
Hi,

I'am having following problem with CR crosstab. (Crystal Version is 9.2 and database is MS SQl Server.)

Crosstable now looks like this:
[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]12/04[ ][ ][ ][ ][ ][ ][ ]1/05[ ][ ][ ][ ][ ][ ][ ]2/05[ ][ ][ ][ ][ ][ ][ ]3/05[ ][ ][ ][ ][ ][ ][ ]4/05[ ][ ][ ][ ][ ][ ][ ]etc.
Case1[ ][ ]10[ ]000
Case2[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]20[ ]000
Case3[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]5[ ]000

Instead it should look like this:
[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]12/04[ ][ ][ ][ ][ ][ ][ ]1/05[ ][ ][ ][ ][ ][ ][ ]2/05[ ][ ][ ][ ][ ][ ][ ]3/05[ ][ ][ ][ ][ ][ ][ ]4/05[ ][ ][ ][ ][ ][ ][ ]etc.
Case1[ ][ ]10[ ]000[ ][ ][ ][ ][ ][ ]10[ ]000
Case2[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]20[ ]000[ ][ ][ ][ ]20[ ]000[ ][ ][ ]20[ ]000
Case3[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]5[ ]000[ ][ ][ ][ ][ ]5[ ]000

Can the same crosstab value be returned to other crosstab columns of the same row? Is this even possible to achieve using crosstab?
Any help would be more than appreciated.



 
I imagine it can be done using some very complex formula. Basically reading nulls and populating previous value if true. Then, use the formula as your data for the body of the cross-tab.

Good Luck.
 
What is the logic for Case 1 starting in 12/04 and ending in 1/05? I.e., we need to know the rules you are applying to the data. Please explain a little about your date fields and what this crosstab is meant to show.

-LB
 
Here is a little more information about the problem. The total amount for example for Case 1 is 20 000, Case 2 60 000 etc. (This is the value that I can get from the database field CaseAmount.)
Now this total amount for Case 1 should be devided starting from 12/04 (December 2004) ending in 1/05 (January 2005), each two months having value 10 000. I get the starting and ending date (month) for the case from database CaseStartDate and CaseEndDate fields. (In Case 1 the start date is "12/1/2004" and end date "1/31/2005")
Hope this clarifies my problem.
 
I think you would have to create a manual crosstab, using detail level formulas like the following:

//{@Dec04}:
if {table.startdate} <= date(2004,12,31) and
{table.enddate} >= date(2004,12,01) then
{table.amt}/datediff("m",{table.startdate},{table.enddate})

//{@Jan05}:
if {table.startdate} <= date(2005,01,31) and
{table.enddate} >= date(2005,01,01) then
{table.amt}/datediff("m",{table.startdate},{table.enddate})

You would group on {table.case} and then right click on each formula and insert a summary (sum). Then suppress the detail section.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top