Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to write code for IF([Reporting Code]= '50010' & [Reporting Code]='50011' ,'Overall Stock' at list box ?

Hi All

Now i have a list box , which allow me to filter Reporting Code for Stock , NSI Stock , Trade Debtor . which is working fine. The code as below :-[

=IF([Reporting Code]='50010','Stock',

IF([Reporting Code]='50011','NSI Stk',

IF([Reporting Code]= '50040','Trade Debtor'

)))

Now i need to sum up the NSI Stock and Stock as one items can called it Overall_Stock. I try below it does not work :-

=IF([Reporting Code]='50010','Stock',

IF([Reporting Code]='50011','NSI Stk',

IF([Reporting Code]= '50010'  & [Reporting Code]='50011' ,'Overall Stock'

)))

Can some one advise me ?

Paul

1 Solution

Accepted Solutions
Not applicable

=IF([Reporting Code]='50010','Stock',

IF([Reporting Code]='50011','NSI Stk',

IF([Reporting Code]= '50010'  or  [Reporting Code]='50011' ,'Overall Stock'

)))

But I'm afraid this might not work as well because you are already assigning values for reporting code 50010 and 50011 already.

If 50010  and 50011  are overall stock then why are you trying to make another selection for overall stock? If the user selects Stock and NSI stk this will give them overall stock anyway.

View solution in original post

5 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Paul,

     This is not possible to have the Stock, NSI stock and overall stock as value in listbox.

     The reason is the third condition will never be fulfilled.

     Instead you can try some other logic like you create a inline table with 3 values as

     Field1

     Stock

     NSI Stk

     Over all Stock

     And you can write if in your expression of charts something like below.

     if(Field1 = 'Stock',sum({<([Reporting Code]={'50010'}>}Value),

           if(Field1 = 'NSI Stk',sum({<([Reporting Code]={'50011'}>}Value),                 

                    if(Field1 = 'Over all Stock',sum({<([Reporting Code]={'50010','50011''}>}Value))))

    

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

=IF([Reporting Code]='50010','Stock',

IF([Reporting Code]='50011','NSI Stk',

IF([Reporting Code]= '50010'  or  [Reporting Code]='50011' ,'Overall Stock'

)))

But I'm afraid this might not work as well because you are already assigning values for reporting code 50010 and 50011 already.

If 50010  and 50011  are overall stock then why are you trying to make another selection for overall stock? If the user selects Stock and NSI stk this will give them overall stock anyway.

paulyeo11
Master
Master
Author

Hi Sir

I enclsoed my QV Doc for your refenece. I am aware about what you said on create a inline load , but i am not sure about the expression.

Paul

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     I tried and yes that approach will not work because you will need to add that if statement every where in your expression, even in set analysis.

     But i tried something with buttons.

     Have a look at the attached example.

Regards,

Kaushik Solanki

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

Hi Sir

Your approach does work , as not many button I need to create , thank you very much .