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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

count doing an Inner join

Hello,

 

Basically what I want to get the below output

 

select count(distinct c.email) from dbo.transactions t
inner join dbo.Contributors c
ON (t.ContributorId=c.Id)

 

Table Transactions is kind of:

 

TId        ContributorId                  Amount

1          1                                           5

2          2                                          6

3          3                                          4

 

Table Contributors

ContributorId       Email                  

1                            pepe@hotmail.com            

2                            rosa@hotmail.com              

3                            pepe@hotmail.com            

 

AS the result, I need all the different emails that are in Transaction table. In this case I will have 2 emails (differents) in transaction table.

 

 

2 REPLIES 2
Cmcmahan
Resident Rockstar
Resident Rockstar

This looks like you can just set up a relationship between your tables and then use this measure to get the count of distinct email addresses:

 

CountDistinctEmail = DISTINCTCOUNT('Contributors'[Email])

If you're trying to get a column of all the different values in the 'Contributors'[Email] column for future use you can use:

DistinctEmailValues = VALUES('Contributors'[Email])

Adding a relationship and using DISTINCTCOUNT would be the same as just using DISTINCTCOUNT so I don't think that's what the question is looking for.

 

For the inner join part to be taken into consideration i can think of a couple of ways (both require the relationship on contributorid) :

a calculated table

Table = SUMMARIZE (
txn,
"Dist Emails", DISTINCTCOUNT( Contributors[email] )
)

OR

a measure

distinct mails with txn = CALCULATE(DISTINCTCOUNT(Contributors[email]), FILTER(txn,txn[tid] > 0))

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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