cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Drobinson1 Member
Member

Running Total by Product/Warehouse

I am trying to do a running total by product and warehouse to get inventory balances.  I am doing this in direct query as a measure on 1.3 million rows, before filtering by a part code.  I isn't working.

 

 

I have tried 

Remaining balance = CALCULATE(SUM(RC_Inventory_Movements_View[IC_MOVE_QUANTITY]),FILTER(ALL(RC_Inventory_Movements_View[MOVEMENT_DATE]),RC_Inventory_Movements_View[MOVEMENT_DATE]<=MAX(RC_Inventory_Movements_View[MOVEMENT_DATE]))

 

and total = SUMX(FILTER(ALL(RC_Inventory_Movements_View),RC_Inventory_Movements_View[MOVEMENT_DATE]<=MAX(RC_Inventory_Movements_View[MOVEMENT_DATE])),[MoveQTy])

 

neither are working. It just keeps spinning when adding it to a visual table.

 

We want to be able to select a part code and see the inventory movements along with ending balance(this needs to be calcuated i.e. the running total).

 

 

2 REPLIES 2
RMDNA Senior Member
Senior Member

Re: Running Total by Product/Warehouse

@Drobinson1,

 

In order to evaluate your calculations, we need more info - either a .PBIX with fabricated sample data or some examples of your data and the results you'd like to see.

 

I'd also run your code through Dax Formatter so we can read it more easily.

 

Example:

Spoiler
total =
SUMX (
    FILTER (
        ALL ( RC_Inventory_Movements_View ),
        RC_Inventory_Movements_View[MOVEMENT_DATE]
            <= MAX ( RC_Inventory_Movements_View[MOVEMENT_DATE] )
    ),
    [MoveQTy]
)
Drobinson1 Member
Member

Re: Running Total by Product/Warehouse

CALCULATE(

SUM(RC_Inventory_Movements_View[IC_MOVE_QUANTITY]),

FILTER(

ALL(RC_Inventory_Movements_View[MOVEMENT_DATE]),

RC_Inventory_Movements_View[MOVEMENT_DATE]<=MAX(RC_Inventory_Movements_View[MOVEMENT_DATE])

)

 

 

The data is just movements sorted by date and a qty moved. This screen shot is prefiltered by partcode.

 

image.png