# Combining 2 statements into 1

Hi!, currently there is an expression that is made based on an IF statement, now I am willing to switch it into a single straight condition, but I can seem to make it work.

Any suggestions?

Current Logic:

If(

//1-

Sum(

{\$<IsInQueue={1}>}ContactDurationQH >=(ServiceLevelAgreement*1000)

)

,

//2-

Count(

{\$<

UseServiceLevelThreshold        =        {1},

ContactStateID                                =        {1},

ContactDirection                            =        {1},

OutboundSkill                                 =        {0},

ContactStartDate                           =        {">=\$(varCalendarStartDateTZ)<\$(varCalendarEndDateTZ)"}

>}

DistinctContactID)

,

0

)

Desired result:

//1

Count(

{\$<

UseServiceLevelThreshold        =        {1},

ContactStateID                                =        {1},

ContactDirection                        =        {1},

OutboundSkill                              =        {0},

ContactStartDate                        =        {">=\$(varCalendarStartDateTZ)<\$(varCalendarEndDateTZ)"},

ContactID                                        =     {"Sum({\$<IsInQueue={1}>}ContactDurationQH >=(ServiceLevelAgreement*1000))"}<<<<<------ ERROR

>}

DistinctContactID

)

How can I combine this logic into the set analysis filtering?

So the Sum of ContactDurationQH, of the IsInQueue Records, is also greater than the ServiceLevelAgreement*1000 ???

-Ed

• ###### Combining 2 statements into 1

After giving it a littler more effort I think I got it working:

Count(

{\$<

UseServiceLevelThreshold          =          {1},

ContactStateID                                        =          {1},

ContactDirection                              =          {1},

OutboundSkill                                        =          {0},

ContactStartDate                              =          {">=\$(varCalendarStartDateTZ)<\$(varCalendarEndDateTZ)"},

ContactID                                                   =          {"=Sum({\$<IsInQueue={1}>}ContactDurationQH) >=(ServiceLevelAgreement*1000)"}

>}

Distinct ContactID)

This syntax is working now, but still I am open to any kind of suggestion, maybe on performance?

Thanks!

-ed