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
yorick1973
New Member

Getting an average of distinct items for a category/column

How do I get an average for the total of each distinct Item on a list?

Item NameCategoryAge
AClass X2
BClass Y10
CClass Z5
DClass X6
EClass Y2
AClass X4

 

When I do an average of Age by Category, I get the following:

Class X = 4 ((2+6+4)/3 Items)
Class Y = 6 (10+2)/2 Items)
Class Z = 5 (5/1 Item)

I need to show the average per distinct Item.  If an Item has more than one entry, then the total of that Item is to be counted as one entry.  The desired result would be this:
Class X = 6 ((2+6+4)/2 Distinct Items)
Class Y = 6 (10+2)/2 Items)
Class Z = 5 (5/1 Item)

How do I achieve that?

1 ACCEPTED SOLUTION
qqqqqwwwweeerrr
Super User
Super User

Hi @yorick1973 

 

This can be achived by using this dax:

 

average_ = DIVIDE(SUM('Table'[Age]),CALCULATE(DISTINCTCOUNT('Table'[Item Name]),ALLEXCEPT('Table','Table'[Category])))
this waht i am getting as an output
qqqqqwwwweeerrr_0-1717594660496.png

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

View solution in original post

2 REPLIES 2
qqqqqwwwweeerrr
Super User
Super User

Hi @yorick1973 

 

This can be achived by using this dax:

 

average_ = DIVIDE(SUM('Table'[Age]),CALCULATE(DISTINCTCOUNT('Table'[Item Name]),ALLEXCEPT('Table','Table'[Category])))
this waht i am getting as an output
qqqqqwwwweeerrr_0-1717594660496.png

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

Moetazzahran
Resolver II
Resolver II

Measure =
CALCULATE(SUM('Table'[Age])/DISTINCTCOUNT('Table'[Item Name]),ALL('Table'),'Table'[Category]=SELECTEDVALUE('Table'[Category]))
If the solutions answers your problem, pls mark my post as a solution and your Kudos is 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.