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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
WOLFIE
Helper I
Helper I

Changing slicer condition to AND

Hi all,

 

I am trying to work this out for ages. I found many different solutions online, but nothing worked. It's a simple one table one slicer solution. I need to filter the ID by the selected rules in the slicer. PBI default is OR condition, but I need to change it to AND.

WOLFIE_0-1645439149618.png

data:
IDRule

1a
2a
2b
3c
3a
3d
4b
4a
5b
6d
6e
7d
7e
7a
7f
7g
8d
8a
9e
10a
10d


Thanks 🙂

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@WOLFIE , Try Measure

 


measure =
var _cnt = calculate(DistinctCount('Table'[Rule]) ,allselected('Table'))
return
countx(filter(summarize('Table', 'Table'[ID], "_1", DistinctCount('Table'[Rule])),[_1]=_cnt),[ID])

 

 

or

 

measure =
var _cnt = calculate(DistinctCount('Table'[Rule]) ,allselected('Table'))
return
calculate(countx(filter(summarize('Table', 'Table'[ID], "_1", DistinctCount('Table'[Rule])),[_1]=_cnt),[ID]), filter(allselected(Table), Table[ID] =max(Table[ID])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

WOLFIE
Helper I
Helper I

@amitchandak Quick additional question 🙂 I need the table to keep all values when nothing is selected in the slicer. I tried this, but it doesn't work:

WOLFIE_0-1645451919109.png

measure =
VAR _cnt = CALCULATE(DISTINCTCOUNT('Customer'[Rule]) ,ALLSELECTED('Customer'))
RETURN
IF(ISFILTERED(Customer),
CALCULATE(
COUNTX(
FILTER(
SUMMARIZE('Customer', 'Customer'[ID], "_1",
DISTINCTCOUNT('Customer'[Rule])),[_1]=_cnt),[ID]),
FILTER(ALLSELECTED(Customer),'Customer'[ID] = MAX('Customer'[ID])
)
),1)

View solution in original post

4 REPLIES 4
WOLFIE
Helper I
Helper I

@amitchandak Quick additional question 🙂 I need the table to keep all values when nothing is selected in the slicer. I tried this, but it doesn't work:

WOLFIE_0-1645451919109.png

measure =
VAR _cnt = CALCULATE(DISTINCTCOUNT('Customer'[Rule]) ,ALLSELECTED('Customer'))
RETURN
IF(ISFILTERED(Customer),
CALCULATE(
COUNTX(
FILTER(
SUMMARIZE('Customer', 'Customer'[ID], "_1",
DISTINCTCOUNT('Customer'[Rule])),[_1]=_cnt),[ID]),
FILTER(ALLSELECTED(Customer),'Customer'[ID] = MAX('Customer'[ID])
)
),1)

SOLVED 🙂 

WOLFIE_0-1645453725114.png

 

amitchandak
Super User
Super User

@WOLFIE , Try Measure

 


measure =
var _cnt = calculate(DistinctCount('Table'[Rule]) ,allselected('Table'))
return
countx(filter(summarize('Table', 'Table'[ID], "_1", DistinctCount('Table'[Rule])),[_1]=_cnt),[ID])

 

 

or

 

measure =
var _cnt = calculate(DistinctCount('Table'[Rule]) ,allselected('Table'))
return
calculate(countx(filter(summarize('Table', 'Table'[ID], "_1", DistinctCount('Table'[Rule])),[_1]=_cnt),[ID]), filter(allselected(Table), Table[ID] =max(Table[ID])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

The second one works! 🙂 Thanks so much!!!

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.