Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Several if conditions in a formula

I want to use several if-selections in 1 formula.

E.g.

Country, Customer, CustomerOrders

Netherlands, A, 5

Netherlands, B, 7

Netherlands, C, 8

Belgium, N, 8

Belgium, O, 5

Belgium, P, 6

Germany, A, 7

Germany, R, 7

Germany, S, 9

The goal is to count all CustomerOrders for the Netherlands for Customers A + B, and for Belgium for Customers O + P, and for Germany for the Customers R + S

I have a begin:
Count(if(Country = Netherlands and (Customer = A or Customer = B), CustomerOrders))...but then I get stuck.

Can somebody help me with this formula?

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You can use like this

    = if(Country = Netherlands,Count({<Country={'Netherlands'},Customer={'A','B'}>} CustomerOrders),if(Country = Belgium ,Count({<Country={'Belgium'},Customer={'O','P'}>} CustomerOrders),if(Country = Germany,Count({<Country={'Germany'},Customer={'R','S'}>} CustomerOrders))

)

)

Celambarasan

View solution in original post

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You can use like this

    = if(Country = Netherlands,Count({<Country={'Netherlands'},Customer={'A','B'}>} CustomerOrders),if(Country = Belgium ,Count({<Country={'Belgium'},Customer={'O','P'}>} CustomerOrders),if(Country = Germany,Count({<Country={'Germany'},Customer={'R','S'}>} CustomerOrders))

)

)

Celambarasan

jagan
Partner - Champion III
Partner - Champion III

Hi,

Without using If Statement you can simply use the following expression

=Count({<Country={'Netherlands'},Customer={'A','B'}>} CustomerOrders) +

Count({<Country={'Belgium'},Customer={'O','P'}>} CustomerOrders) +

Count({<Country={'Germany'},Customer={'R','S'}>} CustomerOrders)

Regards,

Jagan.

Not applicable
Author

Thanx Celambarasan, the function you added helped me! It is solved now!