Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Nested MIN/MAX

Hello

 

I have the table:

Col1Col2Col3
A101/01/2000
A202/01/2000
A103/01/2000
A204/01/2000
A105/01/2000
A106/01/2000
A107/01/2000

etc

 

After grouping by Col1 (which can be A, B, etc), I want to find the earliest date where Col2=1 after the latest date where Col2=2 for that group A (or B, C etc).

 

Any idea?

 

Thanks!

 

 

  • Are you expecting this kind of result?

    You can use the measures below:

    Earliest Date = 
    CALCULATE ( MIN ( Data[Col3] ), Data[Col2] = 1, ALLEXCEPT ( Data, Data[Col1] ) )
    Latest Date = 
    CALCULATE ( MAX ( Data[Col3] ), Data[Col2] = 2, ALLEXCEPT ( Data, Data[Col1] ) )

     

2 Replies

  • Hi Anonymous ,

     

    Can you please elaborate this?

    Col2=1 after the latest date where Col2=2

  • Are you expecting this kind of result?

    You can use the measures below:

    Earliest Date = 
    CALCULATE ( MIN ( Data[Col3] ), Data[Col2] = 1, ALLEXCEPT ( Data, Data[Col1] ) )
    Latest Date = 
    CALCULATE ( MAX ( Data[Col3] ), Data[Col2] = 2, ALLEXCEPT ( Data, Data[Col1] ) )