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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ge97aa
New Member

having trouble with simple slicer logic

I'm a Power BI beginner. I think this should be super simple, but for whatever reason I can't get my head around it. Let's say I have the following table called MyTable:

 

RecordNameRecordType

A

special
Bnormal
Cnormal
Dspecial
Enormal

 

Now, I want a single-selection slicer with two values:

  • "Show all records"
  • "Show special records only"

This slicer should filter records in the manner indicated by the slicer value. i.e.:

  • "Show all records" will select all records
  • "Show special records only" will select ONLY records A and D (i.e. the "special" records)

That's it. I want the slicer to have ONLY those two options - either I get ALL the records or ONLY the special records. It should not allow selection of ONLY the "normal" records. How can I do this?

1 ACCEPTED SOLUTION

@ge97aa  A more simple approach is to create the slicer table this way. It's hard to tell if it'd be scalable without knowing more about your MyTable data source.

 

bchager6_2-1679864693687.png

 

Then connect the tables on RecordType

 

bchager6_1-1679864663152.png

 

It produces the same results:

bchager6_3-1679864769382.png

bchager6_4-1679864792151.png

 

 

 

View solution in original post

5 REPLIES 5
bchager6
Super User
Super User

@ge97aa  This might not be a scalable solution but it works. Others might suggest solutions in DAX or M.

  1. Create a slicer table using the Enter Data function within the Home tab of the Power Query Editor with "Show all records" rows for every RecordName and "Show Special Records Only" rows for special RecordNames
    bchager6_0-1679710277417.png
  2. Connect the slicer table to MyTable on RecordName with the Cross filter direction set to both.
    bchager6_1-1679710356174.png
  3. Bring the SlicerValue column from the SlicerTable in to a slicer
    bchager6_2-1679710492482.pngbchager6_3-1679710521328.png

     

 

Thanks! This works for my current purposes, but I agree that it lacks scalability. I'll wait a bit for a potentially more general scalable solution before accepting yours as "the" solution.

 

Nonetheless, greatly appreciated.

@ge97aa  A more simple approach is to create the slicer table this way. It's hard to tell if it'd be scalable without knowing more about your MyTable data source.

 

bchager6_2-1679864693687.png

 

Then connect the tables on RecordType

 

bchager6_1-1679864663152.png

 

It produces the same results:

bchager6_3-1679864769382.png

bchager6_4-1679864792151.png

 

 

 

Yes, I actually settled on that solution before you mentioned it 😉. It does, of course, require a many-to-many relationship, but I suspect that should not cause any unintended side effects as long as I ONLY use this new table for this specific filtering purpose.

Ritaf1983
Super User
Super User

Hello @ge97aa.
This can be achieved with some "cosmetic" tricks.

1. Put the record type on the slicer.
Enable the options:
"show selecet all..."
and
"multi select..."
Here is a picture

Ritaf1983_0-1679707536627.png

2. Sort your record types descendingly.
As shown in the picture

Ritaf1983_1-1679707687988.png

3. Hide "normal" by zooming out the slicer

Ritaf1983_2-1679707886547.png

4. Lock the form with:
"Lock aspect ratio"

Ritaf1983_3-1679708102313.png

5.Insert a white shape without a border to hide the vertical scroll

Ritaf1983_4-1679708373173.png

6. With formatting options, bring this shape to the front

Ritaf1983_5-1679708528739.png

7. Group the shape with the slicer

Ritaf1983_6-1679708673695.png

sample file here:
https://drive.google.com/file/d/1AhJuilPBnKO36-EFzD6bnFCX5BEIMSAD/view?usp=sharing 

If my answer was helpful please give me a Kudos and accept as a Solution.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.