Forum Discussion

Kevin454's avatar
Kevin454
New Member
3 years ago
Solved

Accumulative

Need a column in table that accumulates inventory by item row by row 

 

for example 

Items.        Inv.        Accumulated inv

Mazda        1          1

Mazda        1.         2

Mazda.       3.         5

Acura.         1.         1

Acura         1.          2 

 

How can I do this using Dax column or Measures

 

 

 

  • Hi Kevin454 
    If I understand your measure request, please try this:

    Inventory measure = 
    
    Var _index = MAX(Inventory[Index])
    
    var _items = MAX(Inventory[Items])
    
    var _calc = CALCULATE(SUM(Inventory[Inventory]),FILTER(ALL(Inventory),Inventory[Index]<=_index && Inventory[Items]=_items))
    return _calc


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πŸ‘are nice too.
    Nathaniel

2 Replies

  • Nathaniel_C's avatar
    Nathaniel_C
    Community Champion

    Hi Kevin454 
    If I understand your measure request, please try this:

    Inventory measure = 
    
    Var _index = MAX(Inventory[Index])
    
    var _items = MAX(Inventory[Items])
    
    var _calc = CALCULATE(SUM(Inventory[Inventory]),FILTER(ALL(Inventory),Inventory[Index]<=_index && Inventory[Items]=_items))
    return _calc


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πŸ‘are nice too.
    Nathaniel

    • Nathaniel_C's avatar
      Nathaniel_C
      Community Champion

      Hi Kevin454 ,
      I added an index column in power query, you need an index or a date column in order to sort the table correctly.
      Let me know if you have any questions.

      If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πŸ‘are nice too.
      Nathaniel