Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
bvssudhakar
Contributor II

Need help to write an expression in the combination of alternate state and set analysis

Hello Experts,

I need a help to write the Expression. I have  a Expression something like this

=if(USD_ASP<>0 and ProductType = 'Recommended',Count({Selection1*Selection3}Product_Product_Id)),Count({Selection2*Selection3}Product_Product_Id)))

But this is accepting USD_ASP's Zero values. Can you guys please check this query and help me out from this.

Selection1, Selection2, Selection3 are alternate states

2 Solutions

Accepted Solutions
Partner
Partner

Re: Need help to write an expression in the combination of alternate state and set analysis

What about..

=if(ProductType = 'Recommended',
Count({Selection1*Selection3<USD_ASP={'>0'}>}Product_Product_Id),
Count({Selection2*Selection3<USD_ASP={'>0'}>}Product_Product_Id))

 

are there any USD_ASP <0?

Partner
Partner

Re: Need help to write an expression in the combination of alternate state and set analysis

you have 2 brackets in the first sum..

=if(ProductType = 'Recommended',Sum({{Selection1*Selection3<USD_ASP={">0"}>}USD_ASP),Sum({Selection2*Selection3<USD_ASP={">0"}>}USD_ASP))/
if(ProductType = 'Recommended',Count({Selection1*Selection3<USD_ASP={">0"}>}Product_Product_Id),Count({Selection2*Selection3<USD_ASP={">0"}>}Product_Product_Id))*ExchangeRate

 

remove 1 and see if that helps

7 Replies
bvssudhakar
Contributor II

Re: Need help to write an expression in the combination of alternate state and set analysis

@sunny_talwar@Frank_Hartmann

 

Can you guys Please have a look and help me out from this

 

 

Thank you in advance

Partner
Partner

Re: Need help to write an expression in the combination of alternate state and set analysis

Hi, what is accepting zero values exactly, the else in the IF would accept zero values. 

What exactly do you want the IF statement to do?

 

bvssudhakar
Contributor II

Re: Need help to write an expression in the combination of alternate state and set analysis

Hi,

I want to show the count (Product_product_Id) where USD_ASP <>0 by using alternate states

can you please modify that expression. 

Partner
Partner

Re: Need help to write an expression in the combination of alternate state and set analysis

What about..

=if(ProductType = 'Recommended',
Count({Selection1*Selection3<USD_ASP={'>0'}>}Product_Product_Id),
Count({Selection2*Selection3<USD_ASP={'>0'}>}Product_Product_Id))

 

are there any USD_ASP <0?

bvssudhakar
Contributor II

Re: Need help to write an expression in the combination of alternate state and set analysis

Hi @hopkinsc

It is some thing working, But my total expression is this. if write this expression it is showing error in expression

Can you please check for this once

=if(ProductType = 'Recommended',Sum({{Selection1*Selection3<USD_ASP={">0"}>}USD_ASP),Sum({Selection2*Selection3<USD_ASP={">0"}>}USD_ASP))/
if(ProductType = 'Recommended',Count({Selection1*Selection3<USD_ASP={">0"}>}Product_Product_Id),Count({Selection2*Selection3<USD_ASP={">0"}>}Product_Product_Id))*ExchangeRate

 

Thank you in advance

Partner
Partner

Re: Need help to write an expression in the combination of alternate state and set analysis

you have 2 brackets in the first sum..

=if(ProductType = 'Recommended',Sum({{Selection1*Selection3<USD_ASP={">0"}>}USD_ASP),Sum({Selection2*Selection3<USD_ASP={">0"}>}USD_ASP))/
if(ProductType = 'Recommended',Count({Selection1*Selection3<USD_ASP={">0"}>}Product_Product_Id),Count({Selection2*Selection3<USD_ASP={">0"}>}Product_Product_Id))*ExchangeRate

 

remove 1 and see if that helps

bvssudhakar
Contributor II

Re: Need help to write an expression in the combination of alternate state and set analysis

Hi @hopkinsc

Thank you very much for the solution. It's working NowSmiley Happy