Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Get second earliest date in a column

Hi community, 

I'd like to get the second earliest date in a column of date type. I'm trying the following formula but I'm still getting the earliest, not the second earliest. 

 

second earliest date =
VAR mindate =
CALCULATE ( MIN ( 'Table'[column] ), ALLSELECTED ( 'Table' ) )
RETURN
CALCULATE (
MIN ( 'Table'[column] ),
FILTER ( ALL ( 'Table'), 'Table'[column] < mindate )
)
 
My formula returns 01/01/1000 instead of 01/09/2011

 

 

Any idea of what is wrong in my formula?

Thanks

  • Try:
     
    second earliest date =
    VAR mindate =
    CALCULATE ( MIN ( 'Table'[column] ), ALLSELECTED ( 'Table' ) )
    RETURN
    CALCULATE (
    MIN ( 'Table'[column] ),
    FILTER ( ALLSELECTED ( 'Table'), 'Table'[column] > mindate )
    )

2 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Icon for Community Champion rankCommunity Champion
    Try:
     
    second earliest date =
    VAR mindate =
    CALCULATE ( MIN ( 'Table'[column] ), ALLSELECTED ( 'Table' ) )
    RETURN
    CALCULATE (
    MIN ( 'Table'[column] ),
    FILTER ( ALLSELECTED ( 'Table'), 'Table'[column] > mindate )
    )