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

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

Reply
STEVE_WT
Frequent Visitor

Count of one column based on distinct count of another column being greater than 1

Hi

 

This is probably a basic query but i'm having no luck. 

 

I need a measure to count the number of accounts where the sum of distinct count of products they buy is greater than 1. Distinct count as the customer could buy the same product various times within the date range they select. Basically i need to display the number of customers who buy more than product.

 

So the results of the below would be 2. Customers 005 is in there twice buy just bought the same product in two different orders.

 

DATA TABLE
ACCOUNT NUMBERPRODUCT
001A
001B
002A
002B
002C
003A
004A
005A
005A

 

Appreciate any help.

 

Thanks

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@STEVE_WT Create a measure to count distinct products per account:

DAX
DistinctProductsPerAccount =
CALCULATE(
DISTINCTCOUNT('Table'[PRODUCT]),
ALLEXCEPT('Table', 'Table'[ACCOUNT NUMBER])
)

 

Create a measure to count accounts with more than 1 distinct product:

DAX
AccountsWithMoreThanOneProduct =
CALCULATE(
DISTINCTCOUNT('Table'[ACCOUNT NUMBER]),
FILTER(
VALUES('Table'[ACCOUNT NUMBER]),
CALCULATE(DISTINCTCOUNT('Table'[PRODUCT])) > 1
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@STEVE_WT Create a measure to count distinct products per account:

DAX
DistinctProductsPerAccount =
CALCULATE(
DISTINCTCOUNT('Table'[PRODUCT]),
ALLEXCEPT('Table', 'Table'[ACCOUNT NUMBER])
)

 

Create a measure to count accounts with more than 1 distinct product:

DAX
AccountsWithMoreThanOneProduct =
CALCULATE(
DISTINCTCOUNT('Table'[ACCOUNT NUMBER]),
FILTER(
VALUES('Table'[ACCOUNT NUMBER]),
CALCULATE(DISTINCTCOUNT('Table'[PRODUCT])) > 1
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Perfect. Thanks for the fast response. Much appreciated.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.