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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
RockStarNomad
Frequent Visitor

Average counting each instance in a group only once

I'm trying to create a column with an average for each Name, but the formula should only factor in each unique Code instance one time. Here is the data below with expected output on the right.

For name A1, the average is 60, because we are adding 100, 50, and 30 (one instance each of code xx, yy, and zz regardless of how many times the codes appear) and dividing by the 3 unique codes, and for B1 the average is 20 for the same reason ((10 + 25 +25) / 3).

   OUTPUT
NameCodeValueAverage
A1xx10060
A1xx10060
A1xx10060
A1xx10060
A1yy5060
A1yy5060
A1yy5060
A1zz3060
B1aa1020
B1aa1020
B1bb2520
B1cc2520
B1cc2520

 

Appreciate the help!

3 REPLIES 3
johnt75
Super User
Super User

You can create a measure like

Distinct average =
	AVERAGEX(
		SUMMARIZE( 'Table', 'Table'[Code], 'Table'[Value] ),
		'Table'[Value]
	)

Unfortunately this formula does not work, that generates an average for the whole table, it does not generate an average within each Name

It should do if you put it in a visual with the Name column

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.