Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Several if conditions in a formula

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

3 Replies

Several if conditions in a formula

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

MVP & Luminary
MVP & Luminary

Several if conditions in a formula

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

Several if conditions in a formula

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