Forum Discussion

bilyafamily's avatar
bilyafamily
Regular Visitor
6 years ago
Solved

Subtract Current Row from Previous row in another column

Hello Team I am new to dax kindly assist with a formula that will give me the result below. I want column A to alway have the value of the previous row in Column C. Column A Column B Differenc...
  • Anonymous's avatar
    Anonymous
    6 years ago

    bilyafamily 

     

    You would need to add an index column to your data in Power Query.

     

    Column D =
    VAR currentindex = Sheet1[Index]
    RETURN
        IF (
            Sheet1[Column A] = BLANK (),
            CALCULATE (
                MIN ( Sheet1[Column C] ),
                FILTER ( Sheet1, Sheet1[Index] = currentindex - 1 )
            ),
            Sheet1[Column A] - [Column B]
        )

     

     

    Paul