Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Reference Previous Row for Calculated Column

Hi everyone,    I have the following thable where I have 3 columns:     What I need to doo, is to add a new column where it indicates in a binary code ( 0 , 1) wether the new register is i...
  • jdbuchanan71's avatar
    7 years ago

    Hello Anonymous 

    Give this a try.  It filters the table based on the info from the current row then counts the number of rows returned.  If the count is >= 1 it is a continuing absence.

    Check = 
    VAR CurrWorker = 'Table'[Worker Code]
    VAR CurrDate = 'Table'[Date]
    VAR AbsType = 'Table'[Type Absence]
    RETURN
    IF ( 
        ISBLANK (
            COUNTROWS(
                FILTER('Table',
                'Table'[Worker Code] = CurrWorker &&
                'Table'[Type Absence] = AbsType &&
                'Table'[Date] < CurrDate &&
                'Table'[Date] >= CurrDate -5
                )
            )
        ),1,0)