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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
DemingPDCA
Helper II
Helper II

Create Running Total of Inventory, then find when it goes negative

Looking to create a running total of Inventory and find when it first goes negative - but can't even get the running total to work!

Have a table that looks like this - and I'd like the Inventory over time to be a running total - but as you can see - thats not working:

DemingPDCA_1-1686759136184.png

 

Current Calculation: 

 

Inventory over Time = 
    VAR maxdate = MAX(_Calendar[Date])
    RETURN
    CALCULATE(
        SUM('Inventory Watch (Supply and Demand)'[Due Qty]),
        'Inventory Watch (Supply and Demand)'[CURDUE] <= maxdate,
        ALL('Inventory Watch (Supply and Demand)'[CURDUE])
    )

 

 

Not sure what I'm doing wrong - but its just giving me the line item qty. 

Here's my relationships - in case those are the issue:

DemingPDCA_2-1686759254751.png

 

1 ACCEPTED SOLUTION
DemingPDCA
Helper II
Helper II

Got it to work (had to start over - but figured I'd share)

First Calculated the overall qty

Total Due Qty = Sum('Inventory Watch'[Due Qty])

Not entirely sure what I was doing wrong - but it seemed to start working when I pulled my Total Due Qty out into its own measure - but that may not have actualyl been correlated - I tried too many things at once!

Due Qty running total in Due Date = 
VAR PartNumber = SELECTEDVALUE('Inventory Watch'[Part Number])
VAR QOH = CALCULATE(Max('Part Master'[Quantity On Hand]), FILTER('Part Master', 'Part Master'[Part Number] = PartNumber))
 
RETURN
QOH + 
CALCULATE(
[Total Due Qty]
, FILTER(
ALLEXCEPT('Inventory Watch', 'Part Master'[Part Number])
        , 'Inventory Watch'[Due Date] <= MAX('Calendar'[Date])))



 

 

View solution in original post

1 REPLY 1
DemingPDCA
Helper II
Helper II

Got it to work (had to start over - but figured I'd share)

First Calculated the overall qty

Total Due Qty = Sum('Inventory Watch'[Due Qty])

Not entirely sure what I was doing wrong - but it seemed to start working when I pulled my Total Due Qty out into its own measure - but that may not have actualyl been correlated - I tried too many things at once!

Due Qty running total in Due Date = 
VAR PartNumber = SELECTEDVALUE('Inventory Watch'[Part Number])
VAR QOH = CALCULATE(Max('Part Master'[Quantity On Hand]), FILTER('Part Master', 'Part Master'[Part Number] = PartNumber))
 
RETURN
QOH + 
CALCULATE(
[Total Due Qty]
, FILTER(
ALLEXCEPT('Inventory Watch', 'Part Master'[Part Number])
        , 'Inventory Watch'[Due Date] <= MAX('Calendar'[Date])))



 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors