Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Find the second lowest value in Date Column

Hi community, 

 

I have the following problem, I want to calculate the second lowest date in a Date type column. My data looks as follows:

 

 

I'd like to get the 01/09/2011 date, but I'm getting the 01/01/1000 instead. 

This is the measure I'm trying, any idea where I have the error?

second min date =
VAR mindate =
CALCULATE ( MIN ( 'Table'[column] ), ALLSELECTED ( 'Table' ) )
RETURN
CALCULATE (
MIN ( 'Table'[column] ),
FILTER ( ALL ( 'Table'), 'Table'[column] < mindate )
)
 

 

And this is the measure I get --> 

 

Thanks for your help and time!

 

 

 

 

  • Hi Anonymous ,

     

    Try the following formula:

     

    second min date = 
    VAR mindate =
        CALCULATE( MIN( 'Table'[column] ), ALLSELECTED( 'Table' ) )
    RETURN
        CALCULATE(
            MIN( 'Table'[column] ),
            FILTER( ALL( 'Table'), 'Table'[column] > mindate )
        )

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Try the following formula:

     

    second min date = 
    VAR mindate =
        CALCULATE( MIN( 'Table'[column] ), ALLSELECTED( 'Table' ) )
    RETURN
        CALCULATE(
            MIN( 'Table'[column] ),
            FILTER( ALL( 'Table'), 'Table'[column] > mindate )
        )

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.