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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
BotBot1
Helper III
Helper III

Slicer for certain rows/categories

Hi,

 

I am trying to add a slicer that uses a column from a table that only has 3 possible values (a, b, c). How do i create a slicer so that it will only show 1 and 2 in the slicer and no matter what I do with the slicer (have nothing selected, select one of them or both) it will always show me the rows that have c as their category?

 

Thanks

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@BotBot1 , First create a measure 

you can create a measure like this:

ShowRows =
IF(
Table[Category] = "c",
1,
IF(
SELECTEDVALUE(SlicerTable[Category]) IN {"a", "b"},
1,
0
)
)

 

Create a separate table (SlicerTable) that contains only the values 'a' and 'b'

DAX
SlicerTable =
DATATABLE(
"Category",
STRING,
{
{"a"},
{"b"}
}
)

 

Add a slicer to your report using the SlicerTable[Category] column. This slicer will only show the values 'a' and 'b'.

 

Use the measure you created in step 1 to filter the visualizations. You can apply this measure as a visual-level filter, page-level filter, or report-level filter, depending on your needs. Set the filter to show only rows where the measure equals 1.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

Anonymous
Not applicable

Hi @BotBot1 

 

Please try this:

Here I create a set of sample:

Table:

vzhengdxumsft_0-1725933546767.png

Then add a calculated table:

 

Table 2 = {"AA","BB"}

 

vzhengdxumsft_1-1725933571224.png

At last, create a measure:

 

MEASURE =
VAR _Slicer =
    CONCATENATEX ( 'Table 2', 'Table 2'[Value] ) & "CC"
RETURN
    IF ( CONTAINSSTRING ( _Slicer, SELECTEDVALUE ( 'Table'[ID] ) ), 1 )

 

Add a Slicer with the [Value] field from Table 2, the result is as follow:

vzhengdxumsft_2-1725933753431.pngvzhengdxumsft_3-1725933761930.pngvzhengdxumsft_4-1725933769530.pngvzhengdxumsft_5-1725933776913.png

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @BotBot1 

 

Please try this:

Here I create a set of sample:

Table:

vzhengdxumsft_0-1725933546767.png

Then add a calculated table:

 

Table 2 = {"AA","BB"}

 

vzhengdxumsft_1-1725933571224.png

At last, create a measure:

 

MEASURE =
VAR _Slicer =
    CONCATENATEX ( 'Table 2', 'Table 2'[Value] ) & "CC"
RETURN
    IF ( CONTAINSSTRING ( _Slicer, SELECTEDVALUE ( 'Table'[ID] ) ), 1 )

 

Add a Slicer with the [Value] field from Table 2, the result is as follow:

vzhengdxumsft_2-1725933753431.pngvzhengdxumsft_3-1725933761930.pngvzhengdxumsft_4-1725933769530.pngvzhengdxumsft_5-1725933776913.png

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bhanu_gautam
Super User
Super User

@BotBot1 , First create a measure 

you can create a measure like this:

ShowRows =
IF(
Table[Category] = "c",
1,
IF(
SELECTEDVALUE(SlicerTable[Category]) IN {"a", "b"},
1,
0
)
)

 

Create a separate table (SlicerTable) that contains only the values 'a' and 'b'

DAX
SlicerTable =
DATATABLE(
"Category",
STRING,
{
{"a"},
{"b"}
}
)

 

Add a slicer to your report using the SlicerTable[Category] column. This slicer will only show the values 'a' and 'b'.

 

Use the measure you created in step 1 to filter the visualizations. You can apply this measure as a visual-level filter, page-level filter, or report-level filter, depending on your needs. Set the filter to show only rows where the measure equals 1.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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