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

How to exclude product group at a chart and scipt level?


Hi,

I'm trying to exclude one product group ("Group X") from Product Group list ("Product Groups") so that I don't  have them visible in ListBox so that I don't display them on charts. I can imagine solving that on two levels:

1) Script - which will exclude it from all my analyses

2) Chart / List box level so that I can choose in which analyses I want to have it excluded

Can anybody suggest formulas for both?

- What should be the formula for exclusion in the script?

- How to exclude it at a list box / chart level and where to typ the exclusion (expression field?)

Many thanks

Thomas

1 Solution

Accepted Solutions
swuehl
MVP
MVP

There is an <Expression> field you can select from the dropdown of the list box properties general tab (at the very bottom of the drop down).

Open the expression editor and type something like

=if([Product Groups] <> 'Group X', [Product Groups])

to filter the Group X out of the available groups in that specific list box.

You can use the same expression as a calculated dimension to filter in a chart (or use a set expression in all your aggregation functions in your chart, like

=sum({<[Product Group] -= {'Group X'}>} Value)

Use a similar expression as above in your load script for a permanent filter:

LOAD

     IF([Product Groups] <> 'Group X', [Product Groups]) AS [Product Groups],

     ...

Both will just eliminate the [Product Group] value 'Group X', but won't remove the associated e.g. sales data for that group, so you may want to filter your records using a WHERE clause instead:

LOAD

     [Product Groups]

FROM ...

WHERE [Product Groups] <> 'Group X';

View solution in original post

5 Replies
swuehl
MVP
MVP

There is an <Expression> field you can select from the dropdown of the list box properties general tab (at the very bottom of the drop down).

Open the expression editor and type something like

=if([Product Groups] <> 'Group X', [Product Groups])

to filter the Group X out of the available groups in that specific list box.

You can use the same expression as a calculated dimension to filter in a chart (or use a set expression in all your aggregation functions in your chart, like

=sum({<[Product Group] -= {'Group X'}>} Value)

Use a similar expression as above in your load script for a permanent filter:

LOAD

     IF([Product Groups] <> 'Group X', [Product Groups]) AS [Product Groups],

     ...

Both will just eliminate the [Product Group] value 'Group X', but won't remove the associated e.g. sales data for that group, so you may want to filter your records using a WHERE clause instead:

LOAD

     [Product Groups]

FROM ...

WHERE [Product Groups] <> 'Group X';

Not applicable
Author

Swuehl,

the formula "=if([Product Groups] <> 'Group X', [Product Groups])" is OK but for some reason nothing happens .

Could there ba a reason for that to happen?

Thanks

Not applicable
Author

Got the product name wrong Scripting works. Thanx!

Not applicable
Author

One last question:

What formula should I use if I want to exclude the entire product group except for one product (Product Y)?

thanks

swuehl
MVP
MVP

Check for equality instead of difference:

=if([Product Groups] = 'Product Y', [Product Groups])