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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
markmsc
Frequent Visitor

Help defining a slicer (some data should be included in all selections)

Here's a situation I can't puzzle out.

 

I have a large table with a column that contain one of three values: A, B, or X.

 

I need to add a slicer to a report that uses this table, based on that column.  However the slicer should only contain two choices: Yes and No. 

 

Yes should include rows with values A or X.

 

No should include rows with values B or X.

 

How can we make a slicer that will do this?  The table is large (hundreds of millions of rows), so solutions with too many steps are probably out as they won't perform.

 

Would love ideas for an elegant solution if anyone has any.  This one is breaking my brain!

 

Thank you.

2 ACCEPTED SOLUTIONS
SamWiseOwl
Community Champion
Community Champion

Hi @markmsc 

Use Enter Data to create a table with Two rows for Yes and Two for No join this table onto the large list:

SamWiseOwl_0-1722865790215.png

 

Join these together using Single from the choice table (yes no) to the main table:

SamWiseOwl_1-1722865868999.png

 

Use this in a slicer:

SamWiseOwl_2-1722865932956.png

 

If this works please mark it as a solution for others to find 🙂

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

Gabry
Super User
Super User

Hello @markmsc 

imho you need to work like this

 

Step1 create the table slicer:

SlicerTable =
DATATABLE(
"YesNo", STRING,
{
{"Yes"},
{"No"}
}
)

 

 

Step 2 Create a Measure:

 

IncludeRow =
VAR SelectedValue = SELECTEDVALUE(SlicerTable[YesNo])
RETURN
IF(
SelectedValue = "Yes" && Table[Value] IN {"A", "X"},
1,
IF(
SelectedValue = "No" && Table[Value] IN {"B", "X"},
1,
0
)
)

Step 3 put the measure in the slicer pane:

 

Set the filter to only include rows wher includerow =1

Let me know and don't forget to mark as accepted solution 😉

View solution in original post

3 REPLIES 3
Gabry
Super User
Super User

Hello @markmsc 

imho you need to work like this

 

Step1 create the table slicer:

SlicerTable =
DATATABLE(
"YesNo", STRING,
{
{"Yes"},
{"No"}
}
)

 

 

Step 2 Create a Measure:

 

IncludeRow =
VAR SelectedValue = SELECTEDVALUE(SlicerTable[YesNo])
RETURN
IF(
SelectedValue = "Yes" && Table[Value] IN {"A", "X"},
1,
IF(
SelectedValue = "No" && Table[Value] IN {"B", "X"},
1,
0
)
)

Step 3 put the measure in the slicer pane:

 

Set the filter to only include rows wher includerow =1

Let me know and don't forget to mark as accepted solution 😉

I changed my mind probably you don't need the calculated column

SamWiseOwl
Community Champion
Community Champion

Hi @markmsc 

Use Enter Data to create a table with Two rows for Yes and Two for No join this table onto the large list:

SamWiseOwl_0-1722865790215.png

 

Join these together using Single from the choice table (yes no) to the main table:

SamWiseOwl_1-1722865868999.png

 

Use this in a slicer:

SamWiseOwl_2-1722865932956.png

 

If this works please mark it as a solution for others to find 🙂

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.