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
gancw1
Helper III
Helper III

Display most recent record or highest value for each category

I have a table of student marks with the date the tests are taken.

StudentDateMarks
A10/9/202250
A11/9/202290
A15/9/202280
B11/9/202290
B12/9/202270
C10/9/202285
D14/9/202250
D16/9/202260


How do I create tables showing the first attempt marks, the last attempt marks and the highest marks for each student  ?

 

First attempt 
StudentDateMarks
A10/9/202250
B11/9/202290
C10/9/202285
D14/9/202250

 

Last attempt 
StudentDateMarks
A15/9/202280
B12/9/202270
C10/9/202285
D16/9/202260

 

Highest marks 
StudentDateMarks
A11/9/202290
B11/9/202290
C10/9/202285
D16/9/202260

 

 

1 ACCEPTED SOLUTION
3 REPLIES 3

@amitchandak 

 

In your code

Last Status = var _max = maxx(filter(ALLSELECTED(Data), Data[ID] = Max(Data[ID])), Data[Date]) 
return
CALCULATE(max(Data[Status]), filter((Data) , Data[Date] =_max))

 

What does this expression do ?

Data[ID] = Max(Data[ID])

 

@amitchandak,

Thanks.

I managed to display the date and marks for the first and last attemps.

First Date = MINX( 
FILTER(ALLSELECTED(Table_Marks), Table_Marks[Student]=MIN(Table_Marks[Student])),
Table_Marks[Date] )

First Mark =
    CALCULATE(
        max(Table_Marks[Marks]), FILTER(Table_Marks, Table_Marks[Date]= [First Date]))

However I am unable to get the date for the highest marks.

I have these 2 measures :

Highest Mark = max(Table_Marks[Marks])
Highest Marks Date = CALCULATE(max(Table_Marks[Date]), FILTER(Table_Marks, Table_Marks[Marks]= [Highest Mark]))

 

This will give an incorrect date when a lower mark is attained later

 

In addition, how do I calculate the Average of all the last attempt marks ?

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.