Forum Discussion

kumalasa's avatar
kumalasa
Frequent Visitor
3 years ago
Solved

Create new column with values on previous rows

Hello Threre,

 

I have a table that consists of the columns below, I would like to have a formula that creates the columns "Socket-InComplete" and "Socket-InNewValue".

 

Formula View

 

 

DAX View.

 

Greatly appreciate any insights on this please, thank you.

  • kumalasa , You need to create a cumulative/running total approach. You can use the previous row value which also calculating

     

    example measure using date table

     

    CALCULATE(SUM(Table[Stock In]),filter(date,date[date] <=maxx(date,date[date]))) - CALCULATE(SUM(Table[Stock Out]),filter(date,date[date] <=maxx(date,date[date])))

     

    Power BI Inventory On Hand: https://youtu.be/nKbJ9Cpb-Aw

3 Replies

  • kumalasa , You need to create a cumulative/running total approach. You can use the previous row value which also calculating

     

    example measure using date table

     

    CALCULATE(SUM(Table[Stock In]),filter(date,date[date] <=maxx(date,date[date]))) - CALCULATE(SUM(Table[Stock Out]),filter(date,date[date] <=maxx(date,date[date])))

     

    Power BI Inventory On Hand: https://youtu.be/nKbJ9Cpb-Aw

    • kumalasa's avatar
      kumalasa
      Frequent Visitor

      amitchandak ,

      Thank you very much for your help. I have been stuck on this problem for a long time.