INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Multiple If Statements

Multiple If Statements

(OP)
Hi All,
I have a Crustal Report (2013 that pulls data from a sql database. I have created several formulas that I need to combine calculate the number of client that have a high school deploma/ged and clients that do not have a high school diploma/ged. {Answer.QuestionUid} = 10039 and {Answer.Answer} = "8645" then "HS-GED"; {Answer.QuestionUid} = 10039 and {Answer.Answer} = "8646" then "No_HS-GED") I can get totals for these without any problem. Now to my dilemma. I have to get the total number of clients who have a HS-GED and have been employed for 1 year or two years or 3 years up to 5 years. I tried a running total to count the HS-GED adding in Evaluate {Answer.QuestionUid} = 9993 and {Answer.Answer} = "1". This is the formula for 1 year and the number changes for each year. Running total are not separating the HS-GED and the No-HS-GED. the totals are the same. I have tried using variables and several different formulas without success. I hope this is not too confusing. Any help is greatly appreciated. thanks

talib

RE: Multiple If Statements

Maybe I am a bit confused. But you state two if statements that are for HS-GED and NO_HS-GED (which look fine) which should be part of your running totals. But the last statement {Answer.QuestionUid} = 9993 and {Answer.Answer} = "1" could not be used in the same Evaluate since it appears it refers to the same fields as the if statements (remember CR, for the most part evaluates row by row), thus {Answer.QuestionUid} could not be equal to 10039 and 9993 in the same row.

RE: Multiple If Statements

(OP)
The {Answer.QuestionUid} = 9993 and {Answer.Answer} = "1" represents the number of years the client has been employed. I need to be able to combine the number of HS-GED or No-HS_GED responses with the corresponding number of years. These are the actual formulas I need to combine and then calculate. If {Answer.QuestionUid} = 10039 and {Answer.Answer} = "8645" //HS-GED Yes)// and {Answer.QuestionUid} = 9993 and {Answer.Answer} = "1" //years of employment// then 1. I need to count this for each year of employment up to 5 years. The data is from a sql database if that helps. thanks

talib

RE: Multiple If Statements

Kray4660 raises the key issue. One way of handling this is to insert a group on clientID. Then create one formula for each condition:

//{@GEDYes}:
If {Answer.QuestionID}=10039 and
{Answer.Answer}=8645 then 1

//{@Yrs1}:
If {Answer.QuestionID}=9993 then
{Answer.Answer}

Then create a running total {@GED1year} that does a distinctcount of clientID and evaluate using a formula:

Maximum({@GEDYes},{table.clientID})=1 and
Maximum({@Yrs1},{table.clientID})=1

Reset never.

Repeat for each year of employment and again for {@GEDNo}.

-LB



RE: Multiple If Statements

(OP)
Hello LB,
Your suggestion worked like a charm. You're the best. Thank you very much!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close