Forum Discussion

georgec96's avatar
georgec96
Helper II
4 years ago
Solved

First and last datetime stamp

Hi everyone, I have the following dataset 

 

I am trying to get the first and last datetime stamp for each shift (there are multiple shifts A,B,C,D) per day.

 

I have tried this formula but it doesn't work due to duplicated rows in the trndte column.

 

Measure = CALCULATE ( MIN ( 'Table'[trndte]), FIRSTDATE ( 'Table'[trndte] ) )

 

Any ideas would be much appreciated

 

Thanks

  • Hi georgec96 

    please try New Column

    Last DateTime =
    CALCULATE (
        MAX ( 'Table'[trndte] ),
        ALLEXCEPT ( 'Table', 'Table'[Shift], 'Table'[Date] )
    )

     

3 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi georgec96 

    please try New Column

    Last DateTime =
    CALCULATE (
        MAX ( 'Table'[trndte] ),
        ALLEXCEPT ( 'Table', 'Table'[Shift], 'Table'[Date] )
    )

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi georgec96,
    Can you try 
    MinDate = CALCULATE ( MIN ( 'Table'[trndte]), ALLEXCEPT('Table'[Shift]))
    MaxDate = CALCULATE ( MAX ( 'Table'[trndte]), ALLEXCEPT('Table'[Shift]))