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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
MarianaVilla
Regular Visitor

Average of averages YTD not working

I have a table of students with their scores, some of them take several trainings so they have several scores at the same period (each period = one cycle = one month). 

 

Student grade = average of all their scores in one cycle

 

 

Cycle

 

Student

 

Count of trainings

 

Average of Scores

2023-02

 

YSceQAH

 

1

 

71,4

 

 

ZPFeQAP

 

1

 

55,6

2023-03

 

YScaQAH

 

2

 

83,1

 

 

YScbQAH

 

1

 

77,8

 

 

YScdQAH

 

1

 

77,2

 

 

YSceQAH

 

1

 

93,9

 

 

YScgQAH

 

1

 

92,8

 

 

YSchQAH

 

1

 

89,5

 

 

YSciQAH

 

1

 

96,5

 

 

YSclQAH

 

1

 

63,2

 

 

ZPFeQAP

 

1

 

80,9

 

 

ZQe6QAH

 

1

 

85

2023-04

 

Eig8uQAB

 

1

 

89,4

 

 

YScaQAH

 

1

 

96,7

 

 

YScbQAH

 

1

 

91,2

 

 

YSceQAH

 

1

 

95,6

 

 

YScgQAH

 

1

 

87,8

 

 

ZPFeQAP

 

1

 

96,4

 

 

ZQe6QAH

 

1

 

100

 

To calculate the entire score of the entire class we average each student's grade, meaning an average of all student’s averages. 

For this we create a column that concats each student's id + the cycle and use the quick measurement module which accurately gives us the score:

Overall_cycle_score= 
AVERAGEX(
    KEEPFILTERS(VALUES('Training'[Student_Cycle])),
    CALCULATE(AVERAGE(Training[Score]))
)

Cycle Overall_cycle_score
2023-02 63,5
2023-03 83,99
2023-04 93,87142857

 


Now we need to get this same measurement in a YTD form but Calculate(Overall_cycle_score, datesytd(cycle_date)) isn't working. Table bellow is what we're looking for

 
Cycle Overall_cycle_score Overall_YTD_score
2023-02 63,5 63,5
2023-03 83,99 80,575
2023-04 93,87142857 85,47368421

 

 

What can we do??

1 REPLY 1
Greg_Deckler
Super User
Super User

@MarianaVilla This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.


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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.