Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.