Forum Discussion

topazz11's avatar
topazz11
Helper III
6 years ago
Solved

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])
    RETURN
    DATE(YEAR(__Date),MONTH(__Date),DAY(__Date))
     
    Set the display to just the date and not date and time.

     

  • topazz11 

     

    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_Deckler's avatar
    Greg_Deckler
    Community Champion

    Try:

     

    Column =
    VAR __Date = INT([Column1])
    RETURN
    DATE(YEAR(__Date),MONTH(__Date),DAY(__Date))
     
    Set the display to just the date and not date and time.

     

  • 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-msft's avatar
    v-chuncz-msft
    Community Support

    topazz11 

     

    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]
        )