Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
diwakarnahata
Creator
Creator

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
sunny_talwar

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

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

swuehl
MVP
MVP

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

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