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
Anonymous
Not applicable

Distinct average by two categories

Hello. (sorry for the earlier incomplete post). I am new to power BI. I would like a measure to do a Distinct Average of a column using two (or more) categories for grouping.

 

ID         DATE                Type       Data1    Data2  Data3...etc.

1          01/01/2020         A            3            8

1          01/01/2020         B            5            2

1          01/01/2020         B            5            4

1          01/01/2020         B            5            3

1          01/01/2020         C            7            1

1          01/01/2020         C            7            2

2          01/01/2020         C            7            2

2          01/01/2020         C            7            1

etc...

I would like the Distinct AVG_ID_DATE measure to give: average for Data 1 (ID/Date/Type):

ID        DATE                AVG_ID_DATE

1          01/01/2020       5  (3+5+7)/3 

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I tried the 2nd suggestion, it worked. Thanks!

To add a 3rd group_by category, just add it to the summarize table?

 

averageX(summarize(Table, Table[ID], Table[DATE],Table[Type],"_1", max(Table[Data1])),[_1])

View solution in original post

7 REPLIES 7
CNENFRNL
Community Champion
Community Champion

@Anonymous I suggest transforming such a 2-dimensional into a 1-dimensional table in the first place, so that a versatile measure can be authored instead of specific Data1, Data2, ...

DS.png

 

Measure = AVERAGEX ( DISTINCT ( DS ), DS[Value] )

 

Table.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

That probably would simplify things (a simpler table). Thanks!

amitchandak
Super User
Super User

@Anonymous ,

Try like

Averagex(union(distinct(Table2[Value]),distinct(Table2[Value])),[Value])

 

Can you share sample data and sample output in table format?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Sorry. See edited post above...I tried to clarify why I need distinct average...

@Anonymous , Try as a new measure

 

averageX(values(Table[Type]), max(Table[Data1]))

or
averageX(summarize(Table,Table[DATE],Table[Type],"_1", max(Table[Data1])),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I tried the 2nd suggestion, it worked. Thanks!

To add a 3rd group_by category, just add it to the summarize table?

 

averageX(summarize(Table, Table[ID], Table[DATE],Table[Type],"_1", max(Table[Data1])),[_1])

Greg_Deckler
Community Champion
Community Champion

@Anonymous Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.