6 Replies Latest reply: May 15, 2017 6:23 AM by s Walter

# Expression - Filter for dimension

Hi,

if i use a dimension in a chart and want to filter the values of the dimension, how can i do it?

Example

Dimension: Products

Filter: Name = "Samsung"

The chart should only show Products where "samsung" is found in the field name

regards,

sam

• ###### Re: Expression - Filter for dimension

Hello! Let's say you calculate the sum of sales. Then your expression would be:

Sum({<Name={'*Samsung*'}>}Sales)

• ###### Re: Expression - Filter for dimension

Hi,

yes, but how can i do it for dimensions?

regards,

sam

• ###### Re: Expression - Filter for dimension

Create it as a master dimension  as follow:

=if(Name='*Samsung*',Name,Null())

Example:

• ###### Re: Expression - Filter for dimension

Thanks to you and the others.

I use like instead = because if i used = it shows 0 results.

=if(Name like '*Samsung*',Name,Null())

thanks and regards,

sam

• ###### Re: Expression - Filter for dimension

As suggested by the two , you can achieve by writing a calculated dimension and also using set analysis.

• ###### Re: Expression - Filter for dimension

Hi,

You can also do it in script level where you can mention

if(upper(Products)='SAMSUNG','0','1') as ProductSpecificFlag

Later,you can use this in your calculated dimension,

if(ProductSpecificFlag='0',Products,Null())

This will take all values irrespective to any change in the cases of Samsung(upper case or lower case).

Hope it helps.