Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

diwakarnahata
Contributor

Filter on Expression in table

Hi,

I have created a Metric from Sales metric as below:

=IF(sum(Sales)>10000,'Category-A', 'Category-B')

I have used the above metric in a Table, where i want to have the ability to select or filter our the Categories as per the above expression.

However, since the above categories are calculated as expression, i can neither select nor filter the same.

How, can i limit the straight table to show only a specific Category?

Regards,

Diwakar

4 Replies
MVP
MVP

Re: Filter on Expression in table

The best option would be to create the category in the script and then you would have no issues in filtering out one or the other.

The other option is to create a calculated expression list box using the if statement.

cesaraccardi
Valued Contributor

Re: Filter on Expression in table

Hi,

You can create a dimension on the loading script for this using the same logic and add it as column for your table or a listbox:

Sales:

LOAD

     IF(sum(Sales)>10000,'Category-A', 'Category-B') as Category,

     <other fields>

FROM ...;

This will allow filtering by category.

Cesar

MVP
MVP

Re: Filter on Expression in table

What are the dimensions of your chart?

You can create a list box field expression like

=Aggr( IF(sum(Sales)>10000,'Category-A', 'Category-B'), YourDimensionFieldUsedInTheChart)

cesaraccardi
Valued Contributor

Re: Filter on Expression in table

You could also add a calculation condition to enforce the selection of Category, this way the table content won't be displayed until a Category is selected or the number of possible Categories is narrowed down to 1:

GetPossibleCount(Category) = 1