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

Get a value from the last row for the student

I am new to Power BI and I am trying to get the last test value for a student where the test could have been taken multiple times.  I need to omit the student if they only took the test once.  There are row numbers per student in the table.  The student number field is UMPI_NBR.  the value I want is PHQ9_TOTAL and the row number field is TESTROW.  All I am pulling right now is the largest value of all of the tests beyond the 1st one instead of the value of PHQ9_TOTAL of the MAX TESTROW.

 

Last Visit = SUMX (
    VALUES( Table1[UMPI_NBR] ),
    CALCULATE (MAX(Table1[PHQ9_TOTAL] ), (Table1[TESTROW] > 1) )
)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

This is working for me.  I don't understand the syntax well enough to know why I don't need the UMPI_NBR specified in there somewhere.

 

Last Visit = CALCULATE (
SELECTEDVALUE ( Table1[PHQ9_TOTAL] ),
FILTER ( ALL ( Table1[VISIT] ), Table1[VISIT] = MAX ( Table1[VISIT] ) && Table1[VISIT] > 1)
)

View solution in original post

10 REPLIES 10

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.