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

Grade History Table

I have a table that stores grades per students periodically on the first of the month.  I would like to be able to graph what the most recent grade letter is per student even if there wasn't a grade given that month.  The Grades range from A-F, and the grades are only tabulated on the first of the month.

 

I have a Students and Grades tables as you can see below

Students TableStudents Table

 

 

 

 

 

 

 

 

Grades TableGrades Table

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I was hoping to create a table with the desired result below unless there is a simplistic way to create measures that would allow for me to display the same results.  If you want to play with it directly, you can download my PBIX file at https://drive.google.com/open?id=1xSUeCcKmA_7uL5sbbTarupaM84NiJKrW.

 

My current measure formula is below though seems to calculate for the month of the grade, and then skip until the next grade change for the student.

 

Grade History =
SELECTCOLUMNS (
GENERATE (
'GRADES',
FILTER (
ALLNOBLANKROW ( Dates ),
// Shows one grade date mapped to date
MAXX (
FILTER ( 'GRADES', 'GRADES'[GradeDate] <= Dates[Date] ),
'GRADES'[GradeDate]
)
= 'GRADES'[GradeDate]
&& RELATED ( 'STUDENTS'[StartDate] ) <= Dates[Date]
&& IF (
ISBLANK ( RELATED ( 'STUDENTS'[EndDate] ) ),
Dates[Date],
RELATED ( 'STUDENTS'[EndDate] )
)
>= Dates[Date]
&& ISBLANK ( RELATED ( 'STUDENTS'[STUDENTID] ) ) = FALSE ()
&& Dates[Date] >= DATE ( 2017, 01, 01 )
)
),
"Date", Dates[Date],
"StudentID", Grades[StudentID],
"GradeDate", 'GRADES'[GradeDate],
"Grade", 'GRADES'[Grade]
)

 

Thanks

 

Desired Result - Grades History TableDesired Result - Grades History Table

 

 

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

@freshwave,

 

Here is an example for your reference.

Community Support Team _ Sam Zha
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-chuncz-msft
Community Support
Community Support

@freshwave,

 

Here is an example for your reference.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the quick response.  I am still a newbie when it comes to DAX.

 

I admit I am a bit lost comparing that example where he has two transactions and wants to get the exchange rate to my wanting to build a table that gives me the GradeDate and Grade for the first of every month.

 

Please explain further.

EDITED 03/23/18 12:10PM
It must have taken me some time to digest it as it seemed to make sense last night, and I was able to get it to work today.

 

Thank you very much for your help.

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.