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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Anonymous
Not applicable

Count unique email addresses with filtering out x domain

Hi everyone,

I'm brand new here in the forum, but couldn't find a post/qestion that helped solve the issue I'm currently facing.

 

I have a column ('Practitioners'[PractitionerEmail]) that shows all the emails of our users/customers.

Now, I want to create a measure that counts the unique emails, but leaves out emails with our own domain (i.e. @gmail.com).

 

So far, I've done:

DISTINCTCOUNTNOBLANK('Practitioners'[PractitionerEmail]).
However, this returns all the unique email addresses, and I want to filter our email addresses that contains i.e. "gmail.com".

How do I do this?
 
Thanks!
 
1 ACCEPTED SOLUTION

@Anonymous,

 

You're close. Add a double ampersand (AND) and it should work:

 

Unique Email Addresses = 
CALCULATE (
    DISTINCTCOUNTNOBLANK ( Practitioners[PractitionerEmail] ),
    FILTER (
        ALL ( Practitioners[PractitionerEmail] ),
        NOT CONTAINSSTRING ( Practitioners[PractitionerEmail], "@gmail.com" )
            && NOT CONTAINSSTRING ( Practitioners[PractitionerEmail], "@hotmail.com" )
    )
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
DataInsights
Super User
Super User

@Anonymous,

 

Try this measure:

 

Unique Email Addresses = 
CALCULATE (
    DISTINCTCOUNTNOBLANK ( Practitioners[PractitionerEmail] ),
    FILTER (
        ALL ( Practitioners[PractitionerEmail] ),
        NOT CONTAINSSTRING ( Practitioners[PractitionerEmail], "@gmail.com" )
    )
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thank you so much DataInsights!

That helped, yes!

 

However, is it possible to add more filters than just "@gmail.com"? For instance if I want it to filter out both "@gmail.com" and "@hotmail.com" etc.?

I tried to add another line, but that didnt work😐

 

 

Unique Email Addresses =
CALCULATE (
    DISTINCTCOUNTNOBLANK ( Practitioners[PractitionerEmail] ),
    FILTER (
        ALL ( Practitioners[PractitionerEmail] ),
        NOT CONTAINSSTRING ( Practitioners[PractitionerEmail], "@gmail.com")
        NOT CONTAINSSTRING ( Practitioners[PractitionerEmail], "@hotmail.com")
    )
)

@Anonymous,

 

You're close. Add a double ampersand (AND) and it should work:

 

Unique Email Addresses = 
CALCULATE (
    DISTINCTCOUNTNOBLANK ( Practitioners[PractitionerEmail] ),
    FILTER (
        ALL ( Practitioners[PractitionerEmail] ),
        NOT CONTAINSSTRING ( Practitioners[PractitionerEmail], "@gmail.com" )
            && NOT CONTAINSSTRING ( Practitioners[PractitionerEmail], "@hotmail.com" )
    )
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thank you 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.