Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Difference between two rows with previous day, same Work Item Id

Completed Daily = for a given row, it is the difference between the Completed Work column and the previous value (previous day, same Work Item Id)   http://prntscr.com/ktxpn4       Exampl...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Anonymous,

     

    You can try to use below calculate column formula to achieve your requirement:

    Completed Daily =
    VAR previous =
        CALCULATE (
            MAX ( Test[Changed Date] ),
            FILTER (
                ALL ( Test ),
                [Work Item Id] = EARLIER ( [Work Item Id] )
                    && [Changed Date] < EARLIER ( Test[Changed Date] )
            )
        )
    RETURN
        [Work]
            - LOOKUPVALUE (
                Test[Work],
                Test[Work Item Id], [Work Item Id],
                Test[Changed Date], previous
            )
    

     

    Regards.

    Xiaoxin Sheng