Forum Discussion

PaulBoden's avatar
PaulBoden
Icon for Helper I rankHelper I
2 years ago
Solved

Updating table rows based on earlier row

Hi all,   I have a solution that needs to integrate manual updates during downtimes before eventually reconciling the data once the correct information becomes available at source.   The solution...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi PaulBoden ,

    You can create a calculated column as below to get it, please find the details in the attachment.

    Output = 
    VAR _id = 'Table'[ID]
    VAR _date = 'Table'[Date]
    VAR _case = 'Table'[Case]
    VAR _level = 'Table'[Level]
    VAR _ladjdate =
        CALCULATE (
            MIN ( 'Table'[Date] ),
            FILTER (
                'Table',
                'Table'[ID] = _id
                    && 'Table'[Flag] = "Adj"
                    && 'Table'[Case] = "L"
            )
        )
    VAR _madjdate =
        CALCULATE (
            MIN ( 'Table'[Date] ),
            FILTER (
                'Table',
                'Table'[ID] = _id
                    && 'Table'[Flag] = "Adj"
                    && 'Table'[Case] = "M"
            )
        )
    RETURN
        IF (
            (
                'Table'[ID] = _id
                    && NOT ( ISBLANK ( _ladjdate ) )
                        && 'Table'[Date] >= _ladjdate
                        && 'Table'[Case] <> "L"
            )
                || (
                    'Table'[ID] = _id
                        && NOT ( ISBLANK ( _madjdate ) )
                            && 'Table'[Date] >= _madjdate
                            && 'Table'[Case] <> "M"
                            && 'Table'[Level] = _level
                ),
            "H"
        )

    Best Regards