Link to home
Start Free TrialLog in
Avatar of J C
J CFlag for United States of America

asked on

Crystal Reports 11.5 Trying to average an nvarchar field

Is there a way to convert the values in the nvarchar field to a numeric value so that I can average it?

I've got a nvarchar field which was named totalincome. The values are strictly numerical and I need to generate the average total income. Any help would be greatly appreciated!
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of J C

ASKER

ToNumber works. Can you also tell me...

I have another field I want to average. It is the BuyerAge field...The values look like this "(c) 25-35"

It's an age range. Is there any way that you can think of that I could average that somehow?

Thank you for your response.
Avatar of Mike McCracken
Mike McCracken

WHa do you want the average to represent?

If you had 2 25-35 and 1 35-45 what would the average be and what would it really mean?

One way would be to average
    25, 25, 35 to get 85/3 = 28.3
    35, 35, 45 to get  115/3 = 38.3

so the average would be 28.3 - 38.3
Not sure how meaningful that really is.

mlmcc
Avatar of J C

ASKER

You're right, it doesn't make sense. They are asking for the average age of the person and I think what I was looking to do was to be able to show the average age range since I don't have any other data I can use in the report to represent a real Age.