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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
CityCat35
Frequent Visitor

Find values from one table based on calculated result from another table

I have two tables. The first is a list of all the test scores of my students for each class I teach:

 

StudentCourseTest Result
BobbyScience92
SarahMath99
TimEnglish100
BobbyScience86
SarahMath77
TimEnglish80
BobbyScience61
SarahMath60
TimEnglish70

 

The second table displays the cutpoints used to determine their letter grade.

 

MinMaxGrade
87100A
7586B
6274C
4461D
043F

 

I'm using a matrix visual to display the average test results by student/course, and I also want to automatically show the letter grade based on the average results--but I'm stuck. How do I go about looking up the grade based on the average test results?

3 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@CityCat35 

you can try this to get the grade

 

Column = maxx(FILTER(Table2,'Table'[Test Result]>=Table2[Min]&&'Table'[Test Result]<=Table2[Max]),Table2[Grade])
 
 
11.PNG




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Joe_Barry
Super User
Super User

Hi @CityCat35 

 

Create a measure

Average Score =
AVERAGE(Exams[Result])

 

Then to get the Grade

Average Grade =
IF([Average Score] >= 87, "A",
IF([Average Score] >= 75 && [Average Score] <= 86, "B",
IF([Average Score] >= 62 && [Average Score] <= 74, "C",
IF([Average Score] >=  44 && [Average Score] <= 61, "D",
IF([Average Score] <= 43, "F", BLANK()) 

 

Add the Student and Subject columns to a Table visual and then the measures

 

Hope this helps

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


View solution in original post

v-tangjie-msft
Community Support
Community Support

Hi @CityCat35 ,

 

Thanks @Joe_Barry  and @ryan_mayu  for the quick reply. Please allow me to provide additional insights:

(1)We can create measures.

Avg = AVERAGE('Table'[Test Result])
Grade = 
MAXX(FILTER(ALLSELECTED('Table (2)'),[Avg]>='Table (2)'[Min] && [Avg]<='Table (2)'[Max]),[Grade])

(2) Then the result is as follows.

vtangjiemsft_0-1719990096483.png

Best Regards,

Neeko Tang

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

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @CityCat35 ,

 

Thanks @Joe_Barry  and @ryan_mayu  for the quick reply. Please allow me to provide additional insights:

(1)We can create measures.

Avg = AVERAGE('Table'[Test Result])
Grade = 
MAXX(FILTER(ALLSELECTED('Table (2)'),[Avg]>='Table (2)'[Min] && [Avg]<='Table (2)'[Max]),[Grade])

(2) Then the result is as follows.

vtangjiemsft_0-1719990096483.png

Best Regards,

Neeko Tang

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

Joe_Barry
Super User
Super User

Hi @CityCat35 

 

Create a measure

Average Score =
AVERAGE(Exams[Result])

 

Then to get the Grade

Average Grade =
IF([Average Score] >= 87, "A",
IF([Average Score] >= 75 && [Average Score] <= 86, "B",
IF([Average Score] >= 62 && [Average Score] <= 74, "C",
IF([Average Score] >=  44 && [Average Score] <= 61, "D",
IF([Average Score] <= 43, "F", BLANK()) 

 

Add the Student and Subject columns to a Table visual and then the measures

 

Hope this helps

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


ryan_mayu
Super User
Super User

@CityCat35 

you can try this to get the grade

 

Column = maxx(FILTER(Table2,'Table'[Test Result]>=Table2[Min]&&'Table'[Test Result]<=Table2[Max]),Table2[Grade])
 
 
11.PNG




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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