damonkimble
MIS
Using Crystal 10 connecting to MS SQL via ODBC.
Basically, I'm looking to do a 'distinct sum.' I am trying to calculate average age across groups that can contain the same persons more than once. As an example, Chone Figgans plays both the infield and outfield for the Angels and shows up in both lists. Using running totals, I am able to get a distinct count of 12, but his age is being added in twice as I can't figure out how to only add it in once. I can post some code if needed, but the example covers the concepts pretty well. Any thoughts would be greatly appreciated!
thank,
damon
Infielders Age
Orlando Cabrera 31
Darin Erstad 31
Chone Figgins 27
Adam Kennedy 29
Casey Kotchman 22
Dallas McPherson 25
Kendry Morales 22
Robb Quinlan 28
---------------------------------------
Infield Totals (8 players w/average age of 26.88) - (215 years / 8 players)
Outfielders Age
Garret Anderson 33
Chone Figgins 27
Steve Finley 40
Vladimir Guerrero 29
Juan Rivera 27
---------------------------------------
Outfield Totals (5 players w/average age of 31.20) - (156 years / 5 players)
Totals (12 players w/average age of 28.67) - (344 years / 12 players)
** Totals (371y / 12p) = 30.92 - this is what my running totals gives me right now
Basically, I'm looking to do a 'distinct sum.' I am trying to calculate average age across groups that can contain the same persons more than once. As an example, Chone Figgans plays both the infield and outfield for the Angels and shows up in both lists. Using running totals, I am able to get a distinct count of 12, but his age is being added in twice as I can't figure out how to only add it in once. I can post some code if needed, but the example covers the concepts pretty well. Any thoughts would be greatly appreciated!
thank,
damon
Infielders Age
Orlando Cabrera 31
Darin Erstad 31
Chone Figgins 27
Adam Kennedy 29
Casey Kotchman 22
Dallas McPherson 25
Kendry Morales 22
Robb Quinlan 28
---------------------------------------
Infield Totals (8 players w/average age of 26.88) - (215 years / 8 players)
Outfielders Age
Garret Anderson 33
Chone Figgins 27
Steve Finley 40
Vladimir Guerrero 29
Juan Rivera 27
---------------------------------------
Outfield Totals (5 players w/average age of 31.20) - (156 years / 5 players)
Totals (12 players w/average age of 28.67) - (344 years / 12 players)
** Totals (371y / 12p) = 30.92 - this is what my running totals gives me right now