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

Getting the right number 1

Status
Not open for further replies.

danzing

IS-IT--Management
Nov 9, 2002
9
US
here is my question that has me stumped I have a database with a row called sex in this row thier is two numbers 1 and 2
1 = man
2 = woman

I need a count of the field which I have done
count ({CBH_2002.SEX})

which equals 702

But what I am stumped on is I need to average the 2 numbers like what is the average amount of men or woman

I was thinking this was easy but I am missing something I could use a little mind prodding to figure this out

Any help would be nice
 
You can't have an average number of men or women!

If you have 702 people, you could say there were 350 men and 352 women but how can you average that?

Perhaps you are looking for a ratio of men to women? 350:352 or "1 to 1.0057"?

Am I missing something? Steve Phillips, Crystal Consultant
 
Oops I mean percentage like what percent where number, 1 what percent where, 2 so on and so forth.

I am completely sorry about that I was thinking of something else,


What I have is a data base that has a bunch of fields that are filled with numbers, the numbers correspond to a survey question.

So It could be a question like this

When you where here, what did you do?

And then a list of questions

Swim = 1
Bowl = 2
Party = 3

And so on some questions have up to 25 different answers

When these are entered they go into the same row?

Like this

|Party----- |Bowl---- |Swim
|1 |2 3
|4 |1 5

And so on,

My mission is to take the ansers and show percentages of what they answered by quarters.

So say each quarter I have 1000 people do the survey I need to break down the question into what the did.

The biggest problem I am having is figuring out how to separate and count the numbers in a reusable formula kind of a across the board way so to speak..

If you are more confused now I do apologize but thanks for the help that you can give

Chris
 
The simplest way would be to create individual formulas for every possible answer.

There are more complex solutions involving arrays etc but the more I go down that route, the more I'd need to know about your data.

Simple solution - Example:

Create the following formulas

Formula name: Swim
// Formula to output 1 if they answered Swim, 0 otherwise
if {Activity_Answer_Field} = 1 then 1
else 0

Formula name: Bowl
// Formula to output 1 if they answered Bowl, 0 otherwise
if {Activity_Answer_Field} = 2 then 1
else 0

Formula name: Party
// Formula to output 1 if they answered Party, 0 otherwise
if {Activity_Answer_Field} = 3 then 1
else 0


You can then insert these field into the details section of the report, you can total the number of answers for Swimming, Bowling and Partying.

Another formula would be needed to show the percentages such as :

FormulaName: SwimPercentage
// Show the Percentage who answered Swim
//
// We are simply dividing the total Swims but the total answers and multiplying by 100
Sum({@Swim}, {GroupName}) / ( Sum({@Swim}, {GroupName}) + Sum({@Bowl}, {GroupName}) + Sum({@Party}, {GroupName})) *100

Hope this gets you on track Steve Phillips, Crystal Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top