Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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!

Tags (1)
1 Solution

Accepted Solutions
kaushik_solanki
Not applicable

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

Try this.

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

Regards,

Kaushik Solanki

5 Replies
Not applicable

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

mov
Not applicable

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

Not applicable

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.

kaushik_solanki
Not applicable

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

Try this.

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

Regards,

Kaushik Solanki

Not applicable

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

Thanks everyone for helping out!!!!