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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JSOTO_PBI
Frequent Visitor

DistinctCount across values (ID) within same table (Master Data)

Hello,

Working with Master Data and trying to get a complete count of distinct records across groups. I'm tyring to figure out how to mimic the sql below into a power bi visualization using DAX and not wanting to duplicate/copy table. thanks in advance for your assistance.

 

Case: There are 8m records, 7m are unique(distinctcount), however only 250k are unique (or match) across my 3 groups. the 250k is the result i'm looking to present.

 

SELECT Count(distinct group1.recno) "TotalLinkedRecords"

FROM

         (select distinct recno FROM person WHERE SRCNO = 1) Group1,

         (select distinct recno FROM person WHERE SRCNO = 2) Group2,

         (select distinct recno FROM person WHERE SRCNO = 3) Group3

WHERE

            Group1.recno = Group2.recno

    AND Group2.recno = Group3.recno

    AND Group3.recno = Group1.recno

 

 

 

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @JSOTO_PBI

 

I had some joy with the following measure, whcih can also be a table if you want to see the results.

 

TotalLinkedRecords = 
	COUNTROWS(
		FILTER(
			SUMMARIZE(
				'Person',
				'Person'[recno],
				"C",COUNTA('Person'[Group])
				)
				,[C]=3))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

Thanks for the response. Much appreciate it.

 

This is close but not exact.  If the dataset had no dups it would result correctly. The dataset also has more than 3 groups though my use case calls to compare between 3.  

 

The table option helped analyze the results and showed that it's counting duplicant entries of the same group.

 

Is it possible to add DISTINCT of [recno] and/or a filter of [groups] (if possible an IN statement) containing only list of groups?

 

thanks.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.