Forum Discussion

nicolasvc's avatar
nicolasvc
Icon for Helper III rankHelper III
5 years ago
Solved

Take previous cell value to build a column

I have in table "Products" a simple column with one cell:

 

Products

1250

 

And other table "dates"

demandofferstock
132112001250+1321-1200
213220231371+2132-2023

 

And I need to fill the column stock with the value 1250 from table Products and then add 1321 - 1200 for the first cell, then with this value 1250+1321-1200= 1371 I need to do the same procedure, but for the next rows down, how can I take the value of the previous cell in the same column and work from it?

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi nicolasvc ,

    Add an index column. Transform data>> Add column>>From 1

    Create a column.

    stock = calculate(sum('dates table'[demand])-sum('dates table'[offer])+MAX(products[Products]),FILTER('dates table',[index]<=EARLIER('dates table'[Index])))

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

    Best Regards

    Community Support Team _ Polly

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi nicolasvc ,

    Add an index column. Transform data>> Add column>>From 1

    Create a column.

    stock = calculate(sum('dates table'[demand])-sum('dates table'[offer])+MAX(products[Products]),FILTER('dates table',[index]<=EARLIER('dates table'[Index])))

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

    Best Regards

    Community Support Team _ Polly

    • nicolasvc's avatar
      nicolasvc
      Icon for Helper III rankHelper III

      Thanks very much! I really appreciate it.

  • richbenmintz's avatar
    richbenmintz
    Icon for Resident Rockstar rankResident Rockstar

    Hi nicolasvc ,

    Does the "dates" table provide a product_id and a date to sort by?

    How are the products and dates tables related?