Forum Discussion

g_js's avatar
g_js
Regular Visitor
5 years ago
Solved

Comparing different times Data in same table

Hi, I was looking into a problem where i need to find the when one column in the data was changed in the table. Example- Date                           Column1                          column2...
  • mahoneypat's avatar
    5 years ago

    Here is a column expression that gets that result.  I called the table "Change" so replace that with your actual table name.

     

    Change From Previous =
    VAR vThisDate = Change[Date]
    VAR vPrevDate =
        CALCULATE (
            MAX ( Change[Date] ),
            ALLEXCEPT (
                Change,
                Change[ Column1]
            ),
            Change[Date] < vThisDate
        )
    VAR vCurrent = Change[Column2]
    VAR vPrevValue =
        CALCULATE (
            MIN ( Change[Column2] ),
            ALLEXCEPT (
                Change,
                Change[ Column1]
            ),
            Change[Date] = vPrevDate
        )
    RETURN
        IF (
            OR (
                ISBLANK ( vPrevDate ),
                vCurrent = vPrevValue
            ),
            0,
            1
        )

     

    Pat