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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Bondeuz
Frequent Visitor

Subtract daily sold amounts from running total

Hi,

 

I am looking for a dax formula to subtract the daily sold amounts from the running total to predict a date were the inventory will be empty.

 

Here is my current visual objects.

Bondeuz_0-1685449856174.png

Here is my expectation of this formula, drawn by the purple line. For the line to start at the last transaction date then subtract the daily sold amounts and to show visually when the stock will be empty.

Bondeuz_1-1685449986621.png


For information my measurments looks like this.

Avail. Inv. = BON_Items[InventoryField]-(BON_Items[Y365_Qty_on_Sales_Order]-BON_Items[Y365_Qty_on_Component_Lines])
ArtTransSumABS = SUM(Yellow_ItemLedgerEntryBI[QuantityABS])
DaysBetween = DATEDIFF(FIRSTDATE(Yellow_ItemLedgerEntryBI[PostingDate]),LASTDATE(Yellow_ItemLedgerEntryBI[PostingDate]),DAY)
Total Quant. Trans. Div by Total Trans. Days = DIVIDE([ArtTransSumABS],[DaysBetween])

For my running total formula its made from the quick measurments.

Running Total for Quantity in Date = 
CALCULATE(
    SUM(Yellow_ItemLedgerEntryBI[Quantity]),
    FILTER(
        ALLSELECTED('Date'[Date]),
        ISONORAFTER('Date'[Date], MAX('Date'[Date]), DESC)
    )
)
0 REPLIES 0

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.