Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
Hi Everyone,
I have the following data.
Student Name | Teacher | Grade |
Bob Smith | Phil Seger | 8th grade |
Bob Smith | Craig Steven | 9th grade |
Bob Smith | Teresa White | 10th grade |
Jim Doe | Larry Daniels | 8th grade |
Jim Doe | Roger Hall | 9th grade |
Jim Doe | Linda Lou | 10th grade |
I want to create an additional column with DAX that would pull the most recent teacher. Therefore, the table would look like:
Student Name | Teacher | Grade | Most Recent Teacher |
Bob Smith | Phil Seger | 8th grade | Teresa White |
Bob Smith | Craig Steven | 9th grade | Teresa White |
Bob Smith | Teresa White | 10th grade | Teresa White |
Jim Doe | Larry Daniels | 8th grade | Linda Lou |
Jim Doe | Roger Hall | 9th grade | Linda Lou |
Jim Doe | Linda Lou | 10th grade | Linda Lou |
How would I go about setting this up in DAX?
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Schedule a short Teams meeting to discuss your question
Hi,
You may download my PBI file from here.
Hope this helps.
@botaac in case you needed a measure
_mostRecentTeacher =
CALCULATE (
CALCULATE (
MAX ( t2[Teacher] ),
FILTER (
t2,
CONVERT ( SUBSTITUTE ( t2[Grade], "th grade", "" ), INTEGER )
= MAXX (
FILTER ( t2, EARLIER ( t2[Student Name] ) = t2[Student Name] ),
CONVERT ( SUBSTITUTE ( t2[Grade], "th grade", "" ), INTEGER )
)
)
),
ALLEXCEPT ( t2, t2[Student Name] )
)
Hi,
Please check the below picture and the attached pbix file.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Schedule a short Teams meeting to discuss your question
Thank you for your assistance! This worked great, best wishes and be safe out there.
Check out the May 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
74 | |
72 | |
71 | |
49 | |
45 |
User | Count |
---|---|
46 | |
38 | |
29 | |
28 | |
28 |