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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AliceW
Impactful Individual
Impactful Individual

A DISTINCTCOUNT measure based on another DISTINCTCOUNT measure

Hi everyone,

This seems simple, but I can't make it work.

I have one table with the Employee Names - one column, let's call it Employee Name.

I have another table with the Salesforce Opportunities and their Ownes - two columns, Opportunity Owner and Opportunity ID.

The tables are connected via a one-to-many link, based on the Employee Name and Opportunity Owner.

I have one measure: Opportunity Count = DISTINCTCOUNT(Oportunity ID). So far, so good 🙂

However, I need another one: the count of Employee Name with an Opportunity Count of zero (or null?).

I've tried this gem: Employees with Zero Opps = calculate(DISTINCTCOUNT(Employee Name), Opportunity Count).

It crashed.

Could you figure out what I'm doing wrong?

Thank you!

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

@AliceW 

Sorry, I misread. What I showed above should yield the number of employees that have opportunities in the Sales Opps table. Try this for those with no opportunities:

Zero Opps V2 =
COUNTROWS (
    EXCEPT (
        DISTINCT ( EmployeeTable[EmployeeName] ),
        DISTINCT ( SalesforceOpportunitiesTable[Opportunity Owner] )
    )
)

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

 

View solution in original post

4 REPLIES 4
AlB
Community Champion
Community Champion

Hi @AliceW 

Try this, where 'SalesforceOpportunitiesTable' is the name of the second table you describe:

Zero Opps =
CALCULATE ( DISTINCTCOUNT ( EmployeeTable[EmployeeName ), SalesforceOpportunitiesTable )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

AliceW
Impactful Individual
Impactful Individual

First of all, thank you for replying so fast!

Second, it gives me the full number of Employees, not the ones without any Opportunities. Could you make this happen, please?

Thanks again!

AlB
Community Champion
Community Champion

@AliceW 

Sorry, I misread. What I showed above should yield the number of employees that have opportunities in the Sales Opps table. Try this for those with no opportunities:

Zero Opps V2 =
COUNTROWS (
    EXCEPT (
        DISTINCT ( EmployeeTable[EmployeeName] ),
        DISTINCT ( SalesforceOpportunitiesTable[Opportunity Owner] )
    )
)

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

 

AliceW
Impactful Individual
Impactful Individual

It works!!!

Thank you so much!!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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