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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
at0kun
Regular Visitor

Create Measure for Distinct Count of a column based on criteria from another column

I am trying to create a measure so I can get a unique count of events I am tracking across multiple email campaigns.

 

In my data I have a column for: Email ID and one for Event Type. I often get duplicate email IDs and event types (if someone opens an email multiple times), so I just need to know if that email and event type happened (don't care how many times it happened)

 

I would like to create a measure to return a distinct count of emails IDs when Event Type = X (Delivered/Opened/Clicked).

 

You cannot use a distinct count expression across multiple columns, and I am struggling to find other options.

 

All other things that I've found are creating a separate table, and I just need a measure, not a new table.

 

Please help!

1 ACCEPTED SOLUTION
v-xjiin-msft
Solution Sage
Solution Sage

@at0kun

 

In your scenario, when Event Type = X you want to return a distinct count of email IDs. Right?

 

Then you can try following DAX expression for a measure:

 

Count Event Type X =
CALCULATE (
    DISTINCTCOUNT ( Table4[Email ID] ),
    FILTER ( ALL ( Table4 ), Table4[Event Type] = "X" )
)

Result shows like: 

 

111.PNG

If above doesn't satisfy your requirement, please kindly share us more information like your source table structure and some sample data with corresponding desired result. So that we can make proper tests.

 

Thanks,
Xi Jin.

View solution in original post

4 REPLIES 4
v-xjiin-msft
Solution Sage
Solution Sage

@at0kun

 

In your scenario, when Event Type = X you want to return a distinct count of email IDs. Right?

 

Then you can try following DAX expression for a measure:

 

Count Event Type X =
CALCULATE (
    DISTINCTCOUNT ( Table4[Email ID] ),
    FILTER ( ALL ( Table4 ), Table4[Event Type] = "X" )
)

Result shows like: 

 

111.PNG

If above doesn't satisfy your requirement, please kindly share us more information like your source table structure and some sample data with corresponding desired result. So that we can make proper tests.

 

Thanks,
Xi Jin.

Anonymous
Not applicable

If I needed to add and additional Column criteria what would that look like?

 

Thanks Xi Jin, that did the trick!  

at0kun
Regular Visitor

 I am trying to create a measure so I can get a unique count of events I am tracking across multiple email campaigns.

 

In my data I have a column for: Email ID and one for Event Type.  I often get duplicate email IDs and event types (if someone opens an email multiple times), so I just need to know if that email and event type happened (don't care how many times it happened)

 

I would like to create a measure to return a distinct count of emails IDs when Event Type = X (Delivered/Opened/Clicked).

 

You cannot use a distinct count expression across multiple columns, and I am struggling to find other options.

All other things that I've found are creating a separate table, and I just need a measure, not a new table.

 

Please help!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors