Forum Discussion
Slicer to Exclude Binary item
Have a super simple column (10 rows total, 9 are equal to '1' and one value is equal to '0'). I want to use a single select slicer to either select all values ( i.e., all '1' and all '0') or select only rows with a '1' (and exclude the '0'), Any advice?
Hey Anonymous ,
to create something like this:
create a table like so (in my example i call this table binaries slicer):
Create a relationship between the new table "binaries slicer" and your table like so:
This approach solely relies on data modeling, this makes creating measures more simple.
But you have to be aware that using many-to-many relationships has to be especially considered for certain kind of measures, e.g. one that uses the function RELATED.
From my personal experience the advantages using the data modeling (many-to.many) approach outweigh an approach based on measures, but as I already mentioned: you have to be aware that you're are using a many-to-many rellationship in your data model.
I strongly recommend watching these videos about relationships
- https://www.sqlbi.com/tv/understanding-relationships-in-power-bi/
- https://www.sqlbi.com/tv/different-types-of-many-to-many-relationships-in-power-bi/
Hopefully, my approach helps to tackle your challenge.
Regards,
Tom
5 Replies
- amitchandak
Super User
Not sure I got it, In slicer, you have the option for single select, refer: https://docs.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-slicers#selection-controls-options-list-slicers-only
- AnonymousNot applicable
Let's say my data looks like the table below. I need the slicer to be a sinle select with two options: the first - 'show all items' which shows the both 1 and 0 items. the second - ' show just 1's' that exlcudes the 0
item 1
1 item 2 0 item 3 1 item 4 1 - TomMartens
Super User
Hey Anonymous ,
to create something like this:
create a table like so (in my example i call this table binaries slicer):
Create a relationship between the new table "binaries slicer" and your table like so:
This approach solely relies on data modeling, this makes creating measures more simple.
But you have to be aware that using many-to-many relationships has to be especially considered for certain kind of measures, e.g. one that uses the function RELATED.
From my personal experience the advantages using the data modeling (many-to.many) approach outweigh an approach based on measures, but as I already mentioned: you have to be aware that you're are using a many-to-many rellationship in your data model.
I strongly recommend watching these videos about relationships
- https://www.sqlbi.com/tv/understanding-relationships-in-power-bi/
- https://www.sqlbi.com/tv/different-types-of-many-to-many-relationships-in-power-bi/
Hopefully, my approach helps to tackle your challenge.
Regards,
Tom