Forum Discussion

Alex215's avatar
Alex215
Frequent Visitor
4 years ago
Solved

Determining Previous Status in Table with Same ID

Hi,   Need some help to determine the best way to approach the below problem. The table below is a good example of what my raw data looks like. I am trying to create the "Past Status" column below ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Alex215 ,

     

    The value of the date column is not unique, please first create a new index column.

    Please create a new calculated column.

    Past Status = 
    VAR _index =
        CALCULATE (
            MIN ( 'Table'[Index] ),
            FILTER (
                'Table',
                'Table'[Index] >= EARLIER ( 'Table'[Index] )
                    && 'Table'[Field] = "status"
                    && 'Table'[id] = EARLIER('Table'[id])
            )
        )
    VAR _status =
        CALCULATE (
            MAX ( 'Table'[OldValue] ),
            FILTER ( 'Table', 'Table'[Index] = _index )
        )
    RETURN
        _status

    Attach the PBIX file for reference. Hope it helps.

     

    Best Regards,
    Community Support Team_Gao

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems with it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data