# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for
Did you mean:
Highlighted
Not applicable

## 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!

1 Solution

Accepted Solutions
Highlighted
MVP & Luminary

Try this.

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

Regards,

Kaushik Solanki

Regards,
Kaushik
5 Replies
Highlighted
Not applicable

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

Highlighted
Champion III

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

Highlighted
Not applicable

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.

Highlighted
MVP & Luminary

Try this.

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

Regards,

Kaushik Solanki

Regards,
Kaushik