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

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).

 

 

3 REPLIES 3
Drobinson1
Helper III
Helper III

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

 

 

 

 

 

 

RMDNA
Solution Sage
Solution Sage

@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]
)

I have kind of same problem.

 

I do a summarize table grouping dates,items I'd, quantities, warehouses, movement types (composed of + and - types)

 

But impossible to use this to get a daily stock image. **bleep** hard

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors