Forum Discussion

backflash's avatar
backflash
Helper II
4 years ago
Solved

Calculate difference between two rows with dependencies

Hey All,   hope someone can help me with the following: I want to calculate the difference between two rows - but I want to do this only for rows where some Column-values are the same. (btw: I al...
  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi backflash 

    Break Time =
    VAR CurrentStart = Table[Start]
    VAR CurrentEnd = Table[End]
    VAR PreviousEnd =
        MAXX (
            FILTER (
                CALCULATETABLE (
                    Table,
                    ALLEXCEPT ( Table, Table[Emplyee Number], Table[Date] )
                ),
                Table[End] < CurrentEnd
            ),
            Table[End]
        )
    RETURN
        IF ( 
            NOT ISBLANK ( PreviousEnd ),
            CurrentStart - PreviousEnd
        )