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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Average percentage of school grades per subject and per category

Hello! I have three tables:

 

Grades, that contains students, subjects and the grades in letters:

StudentsSubjectGrade
1EnglishB
2EnglishB
3EnglishD
1MathsA
2MathsD
3MathsB
1FrenchA
2FrenchC
3FrenchB
1LatinB
2LatinA
3LatinF
1BiologyB
2BiologyB
3BiologyA

 

Percentages, that assigns a percentage value to each grade

GradePercentage
A100
B85
C75
D65
F50

 

And Categories, which assigns a top category to each subject

CategorySubject
LanguageEnglish
LanguageFrench
LanguageLatin
ScienceMaths
ScienceBiology

 

Can someone help me to create a measure that gives me the average percentages per subject or per category in Power BI, i.e. a result like this:

 

Average per subject

English78,33%
French86,66%
Latin78,33%
Maths83,33%
Biology90

 

Average per category

Languages81,11%
Science86,66%

 

I have tried the quick measures in Power BI but they do not seem to work. Then I found solutions like Average=Calculate(average(Percentages[Percentage]),Filter(Grades, (Grades[Subject])="Latin")), which is not exactly what I need because I need the measure to work for all grades and all categories and not just "Latin" as shown here. In addition, the correct average values are not calculated if a single grade occurs twice for a subject (see screenshot below). The average for "Latin" is correct but the one for "English" is not because the grade "B" occurs twice and then it just calculates the average for the two remaining grades. 

 
SubjectAverageLatinAverageEnglish
English 75,00
Latin78,33 

 

Can someone help me with this?

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1603438868945.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1603438868945.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi, thank you for your solution, it works!

 

Someone also showed me this measure to solve the problem as well:

 
Avg Percent = AVERAGEX(Grades,RELATED(Percentages[Percentage]))
 
Best regards!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.