Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

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

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

5 Replies
Not applicable
Author

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

Anonymous
Not applicable
Author

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
Author

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.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

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

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Thanks everyone for helping out!!!!