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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
nhodges
Helper I
Helper I

How to find the latest note in the set of data

Hi my data looks similar to this. I need a way to return the latest Note inputted per ID. So for example it would return the note "Bye" for ID: 1 because that was the last note entered based off of the time.

IDNoteDate
1Hi2/23/2023 10AM
1Hi2/23/2023 10:01AM
1Bye2/23/2023 10:02 AM
2Hi2/23/2023 10AM
2Hi2/23/2023 10:01AM
3Bye2/23/2023 10AM
1 ACCEPTED SOLUTION

hi @nhodges 

try to plot a table visual with the ID column and a measure like:
 
LastMemo =
VAR _lastdate = MAX(TableName[memoDate])
RETURN
MAXX(
    FILTER(
        TableName,
        TableName[memoDate] = _lastdate
    ),
    TableName[memoDesc]
)

View solution in original post

8 REPLIES 8
Greg_Deckler
Community Champion
Community Champion

@nhodges Try:

Measure =
  VAR __ID = MAX('Table'[ID])
  VAR __MaxDateTime = MAXX(FILTER(ALLSELECTED('Table'),[ID] = __ID),[Date])
  VAR __Result = MAXX(FILTER(ALLSELECTED('Table'),[ID] = __ID && [Date] = __MaxDateTime),[Note])
RETURN
  __Result


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...

It says my Syntac for VAR in correct: it is saying it cannot locate the field [id] I know I am in the right table: The measure is as follows:

 

lastmemo =
  VAR __ID = MAX('EDCA Data'[id])
  VAR __MaxDateTime = MAXX(FILTER(ALLSELECTED('EDCA Data',[id] = __ID),[memoDetails.memoDate])
  VAR __Result = MAXX(FILTER(ALLSELECTED('EDCA Data'),[id] = __ID && [memoDetails.memoDate] = __MaxDateTime),[memoDetails.memoDesc])
RETURN
  __Result

@nhodges I think you are missing a )

lastmemo =
  VAR __ID = MAX('EDCA Data'[id])
  VAR __MaxDateTime = MAXX(FILTER(ALLSELECTED('EDCA Data'),[id] = __ID),[memoDetails.memoDate])
  VAR __Result = MAXX(FILTER(ALLSELECTED('EDCA Data'),[id] = __ID && [memoDetails.memoDate] = __MaxDateTime),[memoDetails.memoDesc])
RETURN
  __Result


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...

I just realized my ID field will not convert to a number. the format of the ID field is

ABC-12345-11345

ABC-12345-11346

 

So I think it is having trouble finding the max. Is there a way around this or should I just extract the numbers and put together in seperate column?

@nhodges All depends on context. I was assuming that this would be used in the context where there would be only a single row for ID in context. Can you provide more information on how you are using this?



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...

Hi Greg, Sorry for all the confusion here is a snapshot of the fields I am working with. This Id spans many rows. I would want my solution for this to find the most recent date of that ID, then enter the note that is associated. (some dates repeat)

nhodges_0-1677193923776.png

 

hi @nhodges 

try to plot a table visual with the ID column and a measure like:
 
LastMemo =
VAR _lastdate = MAX(TableName[memoDate])
RETURN
MAXX(
    FILTER(
        TableName,
        TableName[memoDate] = _lastdate
    ),
    TableName[memoDesc]
)

Thank you! This works perfectly

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.