Is this what you were looking for here

I’ve just wrapped that formula inside an if statement

```
Product Name =
IF( SELECTEDVALUE( 'Product Groups'[Top N] ) = "Others", "Others" ,
CALCULATE( SELECTEDVALUE(Products[Product type], BLANK()),
FILTER(VALUES(Products[Product type]),
COUNTROWS(
FILTER( 'Product Groups',
RANKX(All(Products[Product type]),[Total products value],,DESC) > 'Product Groups'[Min]
&& RANKX(All(Products[Product type]),[Total products value],,DESC) <= 'Product Groups'[Max])) > 0 )) )
```

I’ve played around with another idea here.

It’s a bit complicated by it does complete it somewhat.

The idea is to create a supporting table that can enable this filtering. Ie. inside a visual. I review the example you posted and think that you can leverage off this idea.

Now that I’m working through it think this actually might it. It’s a cool solution actually.

Ok here’s how I did.

First you need to create a brand new table off your products.

This will ultimately be the filter in the chart

It doesn’t require any relationship to your core model

Then you require these formulas

```
Total Value (w/Filter) =
CALCULATE( [Total products value],
TREATAS( VALUES( 'Product Filter'[Product type] ), Products[Product type] ) )
Product Value (w/Filter) =
CALCULATE( [Total Value (w/Filter)],
FILTER( VALUES( Products[Product type] ),
COUNTROWS(
FILTER( 'Product Groups',
RANKX( ALL(Products[Product type]), [Total products value] , , DESC) > 'Product Groups'[Min]
&& RANKX( ALL( Products[Product type] ), [Total products value], , DESC) <= 'Product Groups'[Max]) ) > 0 ) )
```

All this is doing is re-creating a virtual filter based off this new table/column that’s been created.

Then create a ranking measure like this

`Ranking = RANKX( ALL( 'Product Filter'[Product type] ), [Total Value (w/Filter)] , , DESC)`

Then you can use this measure as a visual level filter

See here for results

The only thing missing here is the ‘Other’ which is a little tougher I think.

See how you go with this.

Will have to think deeper about the ‘other’ part.

Attached

APP-SalesCRM_TEST (1).pbix (1.4 MB)