W D
asked on
Summation of Yes/No Formula Field
Hi,
I have a formula field in my Details section called _Compliant. _Compliant's formula is:
If
{@Hrs Per Order} <= {@Compliant_Hrs_Per_Ord_Di ff}
Then "Yes"
Else "No"
I need to total the number of yes's and no's in two new fields. Total Compliant = total count of all yes's
Total Non Compliant = total count of all no's
How do I do this?
I have a formula field in my Details section called _Compliant. _Compliant's formula is:
If
{@Hrs Per Order} <= {@Compliant_Hrs_Per_Ord_Di
Then "Yes"
Else "No"
I need to total the number of yes's and no's in two new fields. Total Compliant = total count of all yes's
Total Non Compliant = total count of all no's
How do I do this?
ASKER
Ok, I created a new formula named {@COMPYES}. I went to Insert/Summary but COMPYES wasn't in the list of available fields for summing. How can I manually sum this formula?
I guess I can make another formula named SumCOMPYES that does this: SUM({@COMPYES}).
I guess I can make another formula named SumCOMPYES that does this: SUM({@COMPYES}).
ASKER
I keep getting an err msg stating "this field cannot be summarized". Any thoughts on that?
when you put {@COMPYES} in the detail section does it work, and come up with either 1's or 0's ?
Waht are these formulas
{@Hrs Per Order} and {@Compliant_Hrs_Per_Ord_Di ff}
mlmcc
{@Hrs Per Order} and {@Compliant_Hrs_Per_Ord_Di
mlmcc
ASKER
Hi! Sorry I left the question, many apologies! Our network went down yesterday and today I was trying to catch up to high priority tasks. I'm afraid I put my EE question in lower priority tasks for the day...
Ok, so, kingiely, to answer your question "when you put {@COMPYES} in the detail section does it work, and come up with either 1's or 0's ?"
Yes, it does.
mlmcc, to answer your question "what are these formulas {@Hrs Per Order} and {@Compliant_Hrs_Per_Ord_Di ff} ?"
{@Hrs Per Order} : {@Total Hrs}/{@Ttl Restraints Ordered}
{@Total Hrs}: SUM({@Sum Hrs})
{@Sum Hrs}: ({Command.SEG_END}-{Comman d.SEG_STAR T})*24
{@Ttl Restraints Ordered}: DistinctCount({Command.ORD ER_PROC_ID })
{@Compliant_Hrs_Per_Ord_Di ff}: {@Total Hrs}/{Command.EXPECTED_HRS }
Ok, so, kingiely, to answer your question "when you put {@COMPYES} in the detail section does it work, and come up with either 1's or 0's ?"
Yes, it does.
mlmcc, to answer your question "what are these formulas {@Hrs Per Order} and {@Compliant_Hrs_Per_Ord_Di
{@Hrs Per Order} : {@Total Hrs}/{@Ttl Restraints Ordered}
{@Total Hrs}: SUM({@Sum Hrs})
{@Sum Hrs}: ({Command.SEG_END}-{Comman
{@Ttl Restraints Ordered}: DistinctCount({Command.ORD
{@Compliant_Hrs_Per_Ord_Di
ASKER
ok, here's what I tried: I attempted to make a workaround. I changed _Compliant formula to this:
If
{@Hrs Per Order} <= {@Compliant_Hrs_Per_Ord_Di ff}
Then 1
Else 0
Then I made a new formula called Compliant Display. Compliant Display has this formula:
if {@_Compliant} = 1 then "Yes"
else "No"
Compliant Display will display in the Details section for the appropriate field. Now, I just have to make the summation of _Compliant work. I still get an err msg stating that it cannot be summed.
If
{@Hrs Per Order} <= {@Compliant_Hrs_Per_Ord_Di
Then 1
Else 0
Then I made a new formula called Compliant Display. Compliant Display has this formula:
if {@_Compliant} = 1 then "Yes"
else "No"
Compliant Display will display in the Details section for the appropriate field. Now, I just have to make the summation of _Compliant work. I still get an err msg stating that it cannot be summed.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So, you can't sum something that already uses a summary value? Darn. How do I get around this?
I thought may be it was because I didn't have a If Not Is Null kind of missing statement for _Compliant...
I thought may be it was because I didn't have a If Not Is Null kind of missing statement for _Compliant...
ASKER
So, you can't sum something that already uses a summary value? Darn. How do I get around this?
I thought may be it was because I didn't have a If Not Is Null kind of missing statement for _Compliant...
I thought may be it was because I didn't have a If Not Is Null kind of missing statement for _Compliant...
You cant sum a sum, atleast that way. is why you are getting the error.
Can you do that formular in whatever database you are using, and then just pass the field to the report and then do the sum ?
Ie do the sum formular in the back end eg sql, then put the resulting field on the report, and do the summary?
Can you do that formular in whatever database you are using, and then just pass the field to the report and then do the sum ?
Ie do the sum formular in the back end eg sql, then put the resulting field on the report, and do the summary?
ASKER
kingiely, re: ie do the sum formular in the back end eg sql, then put the resulting field on the report, and do the summary?
Yup, I guess I can do that...
Yup, I guess I can do that...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
kingiely, that's really nice advice, thanks. Much obliged.
Well, I guess I'm gonna revisit my SQL, thanks to both of you!
Well, I guess I'm gonna revisit my SQL, thanks to both of you!
ASKER
Actually, after doing some experimentation, I did this:
Made a Sum Compliant formula:
if {@Compliance Display} = "Yes"
Then COUNT({Command.Pat_ID})
and a Sum NonCompliant formula:
if {@Compliance Display} = "No"
Then COUNT({Command.Pat_ID})
That seems to work. Eeks, I think I'm officially obsessed with this!
Made a Sum Compliant formula:
if {@Compliance Display} = "Yes"
Then COUNT({Command.Pat_ID})
and a Sum NonCompliant formula:
if {@Compliance Display} = "No"
Then COUNT({Command.Pat_ID})
That seems to work. Eeks, I think I'm officially obsessed with this!
I think you will find that counts all records, not just the 'No''s or Yes's, I tried that first.
saying if it finds ANY or even 1 Compliance Display that = "Yes"
Then COUNT all Command.Pat_ID's
You may want to double check but thats my understanding
saying if it finds ANY or even 1 Compliance Display that = "Yes"
Then COUNT all Command.Pat_ID's
You may want to double check but thats my understanding
ASKER
Hmm. I tried it with one sample record. the sample record was non compliant. The Sum NonCompliant field has a 1. The Sum Compliant field has a 0. If you're right kingiely, wouldn't both be 1, then?
ASKER
Actually, no, both wouldn't be one because there aren't any No's yet since I have only one record. You're right kingiely, I was just being stupid.
Ahaha, I didn't say you were being stupid, I tried did the same thing!! :)
Make a new formular called
{@COMPYES}
and put in
if { @_Compliant} = "Yes" then 1 else 0
Put that in the details section,
Then go to 'Insert summary' (on the toolbar) and sum {@COMPYES}
You can then righ click on the {@COMPYES} field and suppress it
DO the same for the No's