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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

How to get the last row of each ID using measure or filter based on date and time stamp

Hi Guys,

 

Newbie here,

 

May I ask how to get the last row of each ID in another table visual.

 

Capture11.PNG

This is a streaming dataset so I cant manipulate the table. 

 

So in the table above, I only want to show the row which contains the last task of each employee ID  which should be the END for 10736211 and MEETING for 10698442.

 

Thank you guys for answering!

2 ACCEPTED SOLUTIONS
vivran22
Community Champion
Community Champion

Hello @Anonymous ,

 

You may try:

Latest Status = 
VAR _LatestTime = 
    MAX('Table'[Date])

VAR _FilterTable = 
    FILTER(
        'Table',
        'Table'[RecordTimestamp] = _LatestTime
    )

VAR _LatestStatus = 
    CALCULATE(
        VALUES('Table'[Task]),
        _FilterTable
    )

RETURN

_LatestStatus

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

View solution in original post

@Anonymous ,

Change all min with max

Measure =
VAR __id = MAX( 'Table'[EmployeeID] )
VAR __date = CALCULATE ( MAX( 'Table'[Date] ), ALLSELECTED ( 'Table' ), 'Table'[EmployeeID] = __id )
RETURN CALCULATE ( sum ( 'Table'[EmployeeID] ), VALUES ( 'Table'[EmployeeID] ), 'Table'[EmployeeID] = __id, 'Table'[Date] = __date )

 
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

7 REPLIES 7
vivran22
Community Champion
Community Champion

Hello @Anonymous ,

 

You may try:

Latest Status = 
VAR _LatestTime = 
    MAX('Table'[Date])

VAR _FilterTable = 
    FILTER(
        'Table',
        'Table'[RecordTimestamp] = _LatestTime
    )

VAR _LatestStatus = 
    CALCULATE(
        VALUES('Table'[Task]),
        _FilterTable
    )

RETURN

_LatestStatus

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

@Anonymous try following measure.

 

Recent Task = 
VAR __maxDate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Employee] ) ) 
RETURN
CALCULATE ( MAX ( 'Table'[Task] ), ALLEXCEPT ( 'Table', 'Table'[Employee] ), 'Table'[Date] = __maxDate ) 

 

I would ? Kudos 🙂 if my solution helped. ?

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

amitchandak
Super User
Super User

@Anonymous ,

Try a new measure like this add to your table

Measure =
VAR __id = MIN ( 'Table'[EmployeeID] )
VAR __date = CALCULATE ( MIN( 'Table'[Date] ), ALLSELECTED ( 'Table' ), 'Table'[EmployeeID] = __id )
RETURN CALCULATE ( sum ( 'Table'[EmployeeID] ), VALUES ( 'Table'[EmployeeID] ), 'Table'[EmployeeID] = __id, 'Table'[Date] = __date )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak,

 

You've got the correct result that I wanted however, this will show the first task not the last. I want to show the last task for each ID.

@Anonymous ,

Change all min with max

Measure =
VAR __id = MAX( 'Table'[EmployeeID] )
VAR __date = CALCULATE ( MAX( 'Table'[Date] ), ALLSELECTED ( 'Table' ), 'Table'[EmployeeID] = __id )
RETURN CALCULATE ( sum ( 'Table'[EmployeeID] ), VALUES ( 'Table'[EmployeeID] ), 'Table'[EmployeeID] = __id, 'Table'[Date] = __date )

 
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak ,

 

I am experiencing another problem by using your given measure, If I add same task . the measure will give 2 outputs. It should be one and only the latest one. Please see the screenshot below.

 

Capture68.PNG

 

It should be like this:

 

Capture89.PNG

 

Thank you so much for answering @amitchandak ! I really appreciate it !

Anonymous
Not applicable

Hi @amitchandak,

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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