Creating a toggle slicer with values from two columns

Hi,
I am trying to solve this problem with disconnected tables. I have a column that has models of vehicles namely Toyota,Honda,Hyundai,Lexus,Volkswagon etc.
And the category is having a division wrt its class. For example,
Toyota,Honda,Hyundai are standard vehicles.
I need to create a slicer/toggle that filters the vehicle models wrt its class. The toggle should have values/selection:
1.Standard Vehicle
2.All vehicles.
If I select standard vehicle, the models that should show are Toyota,Honda,Hyundai.
But if I select All vehicles, all the models Toyota,Honda,Hyundai,Lexus,Volkswagon should be displayed in the table.
If the slicer is with a measure its through disconnected tables, but if we have to create a slicer with data from columns, how can this be implemented?

Thank you for the support.

VehiclesClassification.pbix (34.6 KB)

@Vsb79 ,

Give this a go:

Drop this measure into your filter pane and set it equal to 1:

Standard vs All = 

IF( CONTAINSSTRING( [Harvest Vehicle Cat] , "Standard" ),
    IF( SELECTEDVALUE( Vehicles[StandardVehicles]) = 1, 1, 0),
    IF( [Harvest Vehicle Cat] = "All Vehicles" , 1, 0)
)

where Harvest Vehicle Cat = SELECTEDVALUE( SlicerTable[Filter] )

image

image

I hope this is helpful. Full solution file attached below.

1 Like

well, because I know that @BrianJ likes to see other ways to solve things…

If you were willing to include a measure on your table, you could try something like this:

Vehicle Count = 
VAR _All = COUNTROWS( Vehicles )
VAR _Standard = CALCULATE( COUNTROWS( Vehicles ), Vehicles[StandardVehicles] = "1" )
VAR _Filter = SELECTEDVALUE( SlicerTable[Filter], "All Vehicles" )
RETURN
    IF( _Filter = "StandardVehicles", _Standard, _All )
1 Like

@Vsb79 ,

One other thing I meant to mention - I did a video on this technique a while back. It’s an incredibly flexible, powerful approach that you can use in a whole variety of different scenarios.

  • Brian

@Heather ,

As they say in the classic “Lazy Sunday”,

image

  • Brian
2 Likes

still need a ‘laugh’ reaction on posts for the forum :laughing:

2 Likes