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

Formula question to add

Status
Not open for further replies.

maytwo

IS-IT--Management
Oct 6, 2010
9
US
I am getting a error group condition not allowed on the else sum line - I am needing to add TalkTime, HoldTime and Worktime


if {vwEST.CallsAnswered}<= 0
then 0

else sum({vwEST.TalkTime},{vwEST.HoldTime},{vwEST.WorkTime})

/{vwEST.CallsAnswered}
 
you could consider doing a numbervar declaration... i.e. like below...



numberVar SumTime;
if {vwEST.CallsAnswered}<= 0
then SumTime:=0 else

SumTime:= sum({vwEST.TalkTime},{vwEST.HoldTime},{vwEST.WorkTime})/{vwEST.CallsAnswered};

SumTime
 
will simply adding the values not work?

ie:
({vwEST.TalkTime} + {vwEST.HoldTime} + {vwEST.WorkTime}) / {vwEST.CallsAnswered}
 
fisheromacse...

unfortunately, that wouldn't control for negative values.... which is what it appears maytwo is trying to accomplish...
 
jcrawford08,

If the values are negative, it would subtract them, true.

How is that different from what the SUM function does?

If what is needed is total time, ABS could be used to remove any negatives.
(ABS({Table.Field})+ABS({table.Field2})+etc

The OP formula would sum the 1st field (TalkTime) based on the 2nd field (HoldTime) using the condition given in the 3rd field (WorkTime), which most likely does not contain the proper condition string (such as: "monthly" or "for each day", etc) and that doesn't seem to be what the OP really wanted. Or put another way, it groups values in the 1st field (TalkTime) by the 2nd field (HoldTime) and calculates the sum based on the condition defined by the 3rd field (WorkTime). (i could be wrong in my understanding of what the desired end result is, but i have been wrong once already today tho, so the odds are diminished...LOL).

To sum the fields, they should be between brackets like this: sum([{vwEST.TalkTime},{vwEST.HoldTime},{vwEST.WorkTime}])

 
maytwo,

At what point would {vwEST.CallsAnswered} actually be a negative number? is this a condition that you need to control for? if not, then utilizing the sum function as a standalone function might work all by itself, without needing the additional qualifier.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top