Forum

Find Max for multip...
 
Notifications
Clear all

Find Max for multiple entries

7 Posts
2 Users
0 Reactions
106 Views
(@culsh)
Posts: 43
Trusted Member
Topic starter
 

In PowerBI I have two tables - a student table (DIM) containing student demographic data such as grade level, gender, etc, and a table listing the many Grades, GPA, etc. the students have taken over many different terms (Facts) (3500+ Entries).  I want to report the GPA for the most current term a student has completed.  I have created a column with a numeric value for the terms to allow me to try and find the maximum. 

How can I find the maxiumum Term Value and report the GPA for that term value by Student ID?  I want to use the results in pivot tables that reference the Student table so that I can report GPA by gender, race, etc.

I think this would be like a table of sales by and trying to find the most recent month a salesman they sold something and the value of the sale.  I am imagining that there is a MAX function involved.  I have created queries to get me to this number, and could use that query in the data model, but I think I may be creating duplicated fact tables by doing it that way.

Thank you.

Cheryl Ulsh

 
Posted : 21/01/2020 3:35 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Cheryl,

Is it possible to have more than 1 term value at the same date? In this case, a measure will return more than 1 value for the latest date, we might need another approach.

Please upload a small example of those 2 tables, will be easier to understand the exact situation.

 
Posted : 23/01/2020 12:20 am
(@culsh)
Posts: 43
Trusted Member
Topic starter
 

Sorry for the slow reply.  I've attached the data set.  what I have is multiple entries for each student ID, and I just want to report the most recent term's GPA.  The Term Value is created to be able to find the greatest value.  As I stated before, I am currently using a separate query to get the greatest term value by grouping.  It just seems like an extra and unnecessary step.

 
Posted : 31/01/2020 5:16 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Cheryl,

Please take a look at the attached file and let me know if this is what you're after.

 
Posted : 02/02/2020 6:00 am
(@culsh)
Posts: 43
Trusted Member
Topic starter
 

Yes, the outcome is what I would expect.  I see you added a custom column, but can you explain what that is doing?

 
Posted : 04/02/2020 5:26 pm
(@catalinb)
Posts: 1937
Member Admin
 

It's the term value converted to a number that can be used in calculations and comparisons (MAX, <>)

 
Posted : 05/02/2020 12:55 am
(@culsh)
Posts: 43
Trusted Member
Topic starter
 

Thanks for both the formula and the measure.  Now I need to try and learn more about the filter and all functions.  But I certainly can use this.  Thank you!

 
Posted : 05/02/2020 8:55 am
Share: