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: 
prat1507
Specialist
Specialist

Make a listbox with excluding values

hi All

My query is if I've a listbox say Fruits

Fruits:

Apple

Banana

Pineapple

Mango

Strawberry

I want to Create a listbox as:

Fruits:

Apple

Banana

Pineapple

Mango

Strawberry

Not Mango

If someone selects Not Mango, it must reflect in all the charts showing + I must be able to select Not Mango and Banana together.

Any kind of help will be appreciated. Thanks in advance.

Regards
Pratyush

23 Replies
rahulpawarb
Specialist III
Specialist III

Hello Pratyush,

Trust that you are doing well!

Please refer below as workaround:

Script:

Data:

LOAD * INLINE [

Fruits, Trees

Apple, 10

Banana, 20

Pineapple, 30

Mango, 40

Strawberry, 50

];

Concatenate

LOAD 'No Mango' AS Fruits,

            Sum(Trees) AS Trees

Resident Data

Where Fruits <> 'Mango';

KPI Exression:

='Trees: ' & If(GetCurrentSelections() ='Fruits: No Mango', Sum(Trees), Sum({<Fruits-={'No Mango'}>}Trees))

Also review the sample application attached herewith.

Regards!

Rahul

prat1507
Specialist
Specialist
Author

Hi Rahul

Thanks for your reply, but this is not what I'm looking for. I cant state this for a single KPI, it is being used for multiple KPIs (on multiple charts as well). This would work fine if I've a single expression. Please let me know if what can I do to make it work everywhere.

Regards
Pratyush

prat1507
Specialist
Specialist
Author

Hi Arvind

I want everything under a single filter.


Regards
Pratyush

prat1507
Specialist
Specialist
Author

Hi Kushal

Thanks for your reply, but this is not what I'm looking for. I cant state this for a single KPI, it is being used for multiple KPIs (on multiple charts as well). This would work fine if I've a single expression. Please let me know if what can I do to make it work everywhere.

Regards
Pratyush

arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Pratyush,

Please  Find the  Attachment.

Thanks

Arvind Patil

arvind_patil
Partner - Specialist III
Partner - Specialist III

Here Two solutions of your probelm.

Thanks,

Arvind Patil

prat1507
Specialist
Specialist
Author

Hi Arvind

Thanks for your reply, but this is not what I'm looking for. I cant state this for a single KPI, it is being used for multiple KPIs (on multiple charts as well). This would work fine if I've a single expression. Please let me know if what can I do to make it work everywhere.

Regards
Pratyush

rahulpawarb
Specialist III
Specialist III

Hello Pratyush,

As a workaround, you can add a Flag field (-1 for No Mango else 1) - Refer below script:

Data:

LOAD *, 1 AS Flag INLINE [

Fruits, Trees

Apple, 10

Banana, 20

Pineapple, 30

Mango, 40

Strawberry, 50

];

Concatenate

LOAD 'No Mango' AS Fruits,

            Sum(Trees) AS Trees,

            -1 AS Flag

Resident Data

Where Fruits <> 'Mango';

Modify the existing expression(s) as:

= If(Flag=-1, Sum(Trees), Sum({<Fruits-={'No Mango'}>}Trees))

Hope this will help.

P.S.: Create variables to reduce the maintenance of expressions at various charts & KPIs level.

Regards!

Rahul Pawar

arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Pratyush,

I think That will be solution you need to apply every where.

Thanks,

Arvind Patil

passionate
Specialist
Specialist

Hi Pratyush,

PFA, Solution.

Regards,

Pankaj