Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

New column having into acount previous rows values

 

Hi,

I want a new column that takes into account the values from previous rows.

If "Status" equals to "Resolved", in this row or in previous rows, in new column we should show the value of "Time" column. Otherwise, if in previous rows we haven´t found any Resolved "Status" we should show 0 in the column.

Rows are grouped with "ID" coulmn

 

In this image, "DAX" column shows what we are looking for:

 

Thanks

 

  • Hi,

     

    According to your description, I create a table to test:

    Please take following steps:

    1)Add an index column to table:

    2)After Close&Apply, create a column:

    DAX =

    var Resolve = CALCULATE(MIN('Table'[Index]),FILTER('Table','Table'[ID]=EARLIER('Table'[ID]) && 'Table'[Status]= "Resolved"))

    return 

    IF([Index]<Resolve,0,[Time])

    3)The result shows:

    Here is my test pbix file:

    pbix 

     

    Best Regards,

    Giotto Zhi

1 Reply

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Icon for Community Support rankCommunity Support

    Hi,

     

    According to your description, I create a table to test:

    Please take following steps:

    1)Add an index column to table:

    2)After Close&Apply, create a column:

    DAX =

    var Resolve = CALCULATE(MIN('Table'[Index]),FILTER('Table','Table'[ID]=EARLIER('Table'[ID]) && 'Table'[Status]= "Resolved"))

    return 

    IF([Index]<Resolve,0,[Time])

    3)The result shows:

    Here is my test pbix file:

    pbix 

     

    Best Regards,

    Giotto Zhi