Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
santhiya
Helper I
Helper I

Column value based on Latest date and category filter

Hi @Community!!!
I am having table "Student" as below

id name

1 sam

2 kind


and "Student Activity" as below


student_id status date reported_to

1 started 12/03/2023 bingston

1 break 14/03/2023 rithu


1 started 15/03/2023 rithivi

1 finished 17/03/2023 kiwn

2 started 19/04/2023 ram

2 break 20/04/2023 dithirn

2 started 21/04/2023 rahul
2 break 24/04/2023 rahul
2 finished 25/04/2023 nivin

 

Student table has relationship with Student activity with id and student_id respectively


I need to find the "reported to "column value for each student for the latest date in status with started or break as status and add it as a calculated column(latest_reported_person) to Student Table

for example student id 1 has latest date 15/03/2023 in started and the reported_to column value is rithivi
similarly student id 2 has latest date 24/03/2023 in break status and the reported_to column value is rahul

How to achieve this with DAX?

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@santhiya Try:

Column =
  VAR __MaxDate = MAXX(FILTER(RELATEDTABLE('Activity'),[status]="started"),[date])
  VAR __ReportedTo = MAXX(FILTER(RELATEDTABLE('Activity'),[status]="started" && [date] = __MaxDate),[reported_to)
RETURN
  __ReportedTo


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.