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
lee_the_mee
New Member

New Column with COUNTROWS with filter to exclude multiple values

Hi All,

I have the report that queries the Active directory data to fetch the member's details of some specific security groups in the Power BI report.
I want to exclude three groups values from the "top.cn" column while comparing the cell values in the same column using "Earlier" and populating the values in a new column but whenever I tried to use the "OR" (||) condition then I get the below error on my machine having configuration -  Processor i7 & 32 GB RAM.

PowerBI error.png

The query I'm trying to use to achieve this.

AD_Multiple Group Membership = COUNTROWS(FILTER(MyDomain,
(MyDomain[top.cn]<>"Group A" || MyDomain[top.cn]<>"Group B" || MyDomain[top.cn]<>"Group C" && MyDomain[group.member.cn]) = EARLIER(MyDomain[group.member.cn]))

 

The below existing query for creating the new column which excludes "Group A" only works perfectly fine.

AD_Multiple Group Membership = COUNTROWS(FILTER(MyDomain,
(MyDomain[top.cn]<>"Group A" && MyDomain[group.member.cn]) = EARLIER(MyDomain[group.member.cn]))

 

Can someone guide me, on how I can achieve this?

Thanks in Advance 🙂 

1 ACCEPTED SOLUTION

Hi @lbendlin,
It didn't work but thanks a lot for the tip, I'm able to resolve it with the below query.

 

AD_Multiple group Membership = COUNTROWS(FILTER(MyDomain, EARLIER(MyDomain[group.member.cn]) = MyDomain[group.member.cn] && MyDomain[top.cn]<> "Group A" && MyDomain[top.cn]<> "Group B" && MyDomain[top.cn]<> "Group C"))

 

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

You need to protect your OR statements, otherwise AND takes precedence.

 

Having said that, your OR statements will not actually do anything

 

Try this instead

 

AD_Multiple Group Membership = 
COUNTROWS(FILTER(MyDomain,
MyDomain[top.cn] NOT IN {"Group A","Group B","Group C"} && MyDomain[group.member.cn] = EARLIER(MyDomain[group.member.cn]))

Hi @lbendlin,
It didn't work but thanks a lot for the tip, I'm able to resolve it with the below query.

 

AD_Multiple group Membership = COUNTROWS(FILTER(MyDomain, EARLIER(MyDomain[group.member.cn]) = MyDomain[group.member.cn] && MyDomain[top.cn]<> "Group A" && MyDomain[top.cn]<> "Group B" && MyDomain[top.cn]<> "Group C"))

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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