5 Replies Latest reply: Mar 26, 2013 5:14 AM by Christoph Gerber

# Two "count(if" functions in one formula

Hey everyone,

i need a function which calculates two "if"s in one forumla:

Count(if(medium='cpc',order_id)) -->> i need another if which is (order_status_id=2,5,order_id)

thanks alot!

• ###### Re: Two "count(if" functions in one formula

Hi,

Try with this:

Count(if(medium='cpc', order_id, if(order_status_id=2, 5, order_id)))

or

Count(if(medium='cpc', if(order_status_id=2, 5, order_id)))

That depends on what you need.

Regards,

Ricardo

• ###### Re: Two "count(if" functions in one formula

True, it depends very much on what's needed - which is not quite clear.  Another version of Ricardo's logic:

Count(if(medium='cpc' AND order_status_id=2, 5, order_id))

Regards,

Michael

• ###### Re: Two "count(if" functions in one formula

Hey,

i want to count the orders ( order_id) that have in their table the value for "medium=cpc" and for "order_status_id=2,5"

Count(if(medium='cpc' AND order_status_id=2, 5, order_id)) -> that gives me all the orders.

• ###### Re: Two "count(if" functions in one formula

Try this.

Count({<Medium = {"CPC"},Order_Status_ID = {"2","5"}>} Order_ID)

Regards,

Kaushik Solanki

• ###### Re: Two "count(if" functions in one formula

Thanks everyone for helping out!!!!