How to create cross-tab report as the following re

2020-04-01 10:08发布

Is it possible to use Crystal Report cross-tab to create the following report?

Here is the report:

Sample Report

Growth Rate= (Last Year - First Year)/Total each Area

Here is my result set:

Year    Area    PeopleCount
2005    A       3
2005    B       2
....    ....    ....

If possible, please give me some advice.

1条回答
爷的心禁止访问
2楼-- · 2020-04-01 10:27

I've taken your example data and pulled into a csv: http://speedy.sh/cY9d2/test.txt

Then built a report showing what you want: http://speedy.sh/XC4VJ/test.rpt

enter image description here

I'm sure there's an easier way but CrossTabs do introduce some difficulties. Here's the formula i've used in conjunction with a calculated member:

(
 (
  GridValueAt (CurrentRowIndex, GetNumColumns - 3, 0) 
  -
  GridValueAt (CurrentRowIndex, 0, 0) 
 )
 / GetTotalValueFor ("test_txt.Year")
)
* 100

Simply the GridValueAt (CurrentRowIndex, GetNumColumns - 3, 0) line takes the last value, the GridValueAt (CurrentRowIndex, 0, 0) line takes the first value and / GetTotalValueFor ("test_txt.Year") line the total.

Let us know how you get on and if needed we can come up with some alternative solutions.

查看更多
登录 后发表回答