Forum Discussion
topazz11
6 years agoHelper III
Date conversion
Hello,
I need help a DAX to get maximum (latest) date as below?
There are multiple timestamps on the same date and I need to get a max date from the same date timestamps.
Thank you!
Try:
Column =VAR __Date = INT([Column1])RETURNDATE(YEAR(__Date),MONTH(__Date),DAY(__Date))Set the display to just the date and not date and time.You may use the following DAX to add a calculated column.
Column = VAR d = Table1[Timestamp].[Date] RETURN IF ( RANKX ( FILTER ( Table1, Table1[Timestamp].[Date] = d ), Table1[Timestamp], , DESC ) = 1, Table1[Timestamp] )
4 Replies
- Greg_DecklerCommunity Champion
Try:
Column =VAR __Date = INT([Column1])RETURNDATE(YEAR(__Date),MONTH(__Date),DAY(__Date))Set the display to just the date and not date and time. - Greg_DecklerCommunity Champion
- amitchandakSuper User
Try one of two can give
max = maxx(filter(table, table[timestamp].date = earlier(table[timestamp]).date ),table[timestamp]) max = maxx(filter(table, table[timestamp].date = earlier(table[timestamp].date) ),table[timestamp]) - v-chuncz-msftCommunity Support
You may use the following DAX to add a calculated column.
Column = VAR d = Table1[Timestamp].[Date] RETURN IF ( RANKX ( FILTER ( Table1, Table1[Timestamp].[Date] = d ), Table1[Timestamp], , DESC ) = 1, Table1[Timestamp] )