Forum Discussion

deanbland's avatar
deanbland
Helper III
5 years ago
Solved

How to flag status change

Hi,    I have a dataset like this:    ID Date Status ID1 22/08/2020 Open ID2 22/08/2020 Open ID3 22/08/2020   ID1 22/09/2020 Closed ID2 22/09/2020 Open   I am w...
  • v-kkf-msft's avatar
    v-kkf-msft
    5 years ago

    Hi deanbland ,

     

    Please try the following formula:

     

    Column = 
    var PreDate = 
        MAXX(
            FILTER(
                'Table',
                'Table'[Date] < EARLIER('Table'[Date])
                && 'Table'[ID] = EARLIER('Table'[ID])
            ),
            'Table'[Date]
        )
    var PD_Status = 
        CALCULATE(
            MAX('Table'[Status]),
            FILTER(
                'Table',
                'Table'[Date] = PreDate 
                && 'Table'[ID] = EARLIER('Table'[ID])
            )
        )
    return 
        IF( PD_Status = BLANK() || PD_Status = 'Table'[Status], 0, 1 )

     

     

    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.