Forum Discussion

pa2021's avatar
pa2021
Frequent Visitor
5 years ago

How to have Initial Inventory (Earliest Date Values)+Production-Sales=Remaining Inv. (Matrix Table)

Hello,

How would I go about having a dax measure, giving me:

 

Initial Inventory, based on the earliest date found in the date column;

+ (Sum of Production)

- Sum of Sales

= Remaining inventory.

 

Here's a snapshot of the goal:

 

Here's a snapshot of the way it is right now:

 

Any help is appreciated!


Antonio

7 Replies

  • pa2021 , Try a measure like

     

    calculate(sum(Table[intial Inventory]), filter(Table, Table[Date] = calculate(min(Table[date]), allexcept(Table, Table[product]))))
    - Cumm Sales = CALCULATE(SUM(Table[Production Qty]),filter(allselected(Table),Table[Date] <=max(Table[Date])))
    + Cumm Sales = CALCULATE(SUM(Table[Sales Qty]),filter(allselected(Table),Table[Date] <=max(Sales[Date])))

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        pa2021 , my mistake, try like 

         

        calculate(sum(Table[intial Inventory]), filter(Table, Table[Date] = calculate(min(Table[date]), allexcept(Table, Table[product]))))
        -  CALCULATE(SUM(Table[Production Qty]),filter(allselected(Table),Table[Date] <=max(Table[Date])))
        +  CALCULATE(SUM(Table[Sales Qty]),filter(allselected(Table),Table[Date] <=max(Sales[Date])))