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
ArashZ
Helper I
Helper I

Average based on some specific rows

Hi,

 

I have a table like this: Each user ID has the course name of base and advanced and the duration is the same for each user based on their course name. In fact, for user A, the duration for the base is 36, and for advanced is 27, but it has been written in multiple rows. I want to get an average of duration separately for the base, advanced, and for both together. For instance, the average for the base should be (36,30,20) and the average for advanced is (27,10,15), and for both is (36,27,30,10,20,15).

 

user IDCourse nameStart finish duration
ABase36
ABase36
AAdvanced27
AAdvanced27
AAdvanced27
BBase30
BBase30
BAdvanced10
CBase20
CBase20
CBase20
CAdvanced15
CAdvanced15
CAdvanced15
CAdvanced15
4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

Screenshot 2021-06-14 215228.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!

@CNENFRNLThanks. But is there a way to write a calculated column or measure for that?

If you want a measure then it'll need to create the equivalent of the Table.Distinct(Source) table on the fly.

 

Average Measure =
AVERAGEX(
SUMMARIZE('Table', 'Table'[Course name], 'Table'[user ID], 'Table'[Start finish duration]),
'Table'[Start finish duration]
)
CNENFRNL
Community Champion
Community Champion

Avg = 
SUMMARIZECOLUMNS(
    COURSE[user ID],
    COURSE[Course name],
    "Avg", AVERAGEX( COURSE, COURSE[Start finish duration] )
)

Screenshot 2021-06-14 222602.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!

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.