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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
yz___
New Member

Stock Tracking Resetting

Hi All,

 

I am trying to currently create a stock depletion forecast, with two different excel files, both have been imported and the way it works is that one has the stock with part number, and the other has the part number, quantity required and work date. I want to create a line graph that is depleting over time, however the line keeps bouncing to its orginal number. Code and graph is listed below. I just want to display tracking over the months for individual parts. Thank You!!!

Stock Table Example

Part No.QTY
A11
A11
B21

Work Order Example

Part No.Work DateQuantity 
A11/11
A11/11
B11/21
C11/31


graph.png

Measure 1

Cumulative Demand =
VAR CurrentDate = MAX ( DateTable[Date] )
RETURN
CALCULATE (
[Total Demand],
Maintenance[RepairDate] <= CurrentDate
)
Measure 2

Rolling Balance =
VAR BaseStock =
CALCULATE ( [Serviceable Stock], ALL ( DateTable ) )
RETURN
BaseStock - [Cumulative Demand]

Measure 3
Serviceable Stock =
SUMX (
FILTER ( Stock, Stock[State] = "Serviceable" ),
Stock[Qty]
)
Measure 4
Total Demand =
SUM ( Maintenance[RequiredQty] )


1 ACCEPTED SOLUTION
v-karpurapud
Community Support
Community Support

Hi @yz___ 

Thank you for your question on the Microsoft Fabric Community Forum.


While I’m not fully aware of the exact structure of your dataset, I’ve created a sample .pbix file to demonstrate one possible approach for modeling stock depletion over time by part, ensuring the rolling balance depletes correctly without resetting due to date hierarchies or aggregation issues.

I’ve attached a screenshot and the .pbix file illustrating this logic. Please review them to confirm whether this approach aligns with your requirements.

vkarpurapud_0-1767761114928.png

 

I hope this information is helpful. . If you have any further questions, please let us know. we can assist you further.

 

Regards,

Microsoft Fabric Community Support Team.
 

 

View solution in original post

6 REPLIES 6
v-karpurapud
Community Support
Community Support

Hi @yz___ 

We have not received a response from you regarding the query and were following up to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

 

Thank You.

v-karpurapud
Community Support
Community Support

Hi @yz___ 

I wanted to check if you’ve had a chance to review the information provided. If you have any further questions, please let us know. Has your issue been resolved? If not, please share more details so we can assist you further.

Thank You.

v-karpurapud
Community Support
Community Support

Hi @yz___ 

Thank you for your question on the Microsoft Fabric Community Forum.


While I’m not fully aware of the exact structure of your dataset, I’ve created a sample .pbix file to demonstrate one possible approach for modeling stock depletion over time by part, ensuring the rolling balance depletes correctly without resetting due to date hierarchies or aggregation issues.

I’ve attached a screenshot and the .pbix file illustrating this logic. Please review them to confirm whether this approach aligns with your requirements.

vkarpurapud_0-1767761114928.png

 

I hope this information is helpful. . If you have any further questions, please let us know. we can assist you further.

 

Regards,

Microsoft Fabric Community Support Team.
 

 

danextian
Super User
Super User

HI @yz___ 

 

Can you please post a sample data not matches your expected result and not something overly simplified and the reasoning behind. For example, for  Jan 3, the result is xxx because xxxxx.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
ryan_mayu
Super User
Super User

@yz___ 

what's the expected output based on the sample data you provided?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




rohit1991
Super User
Super User

Hii @yz___ 

 

The line resets because the running total is calculated over all dates, so after the last work-order date Power BI keeps evaluating extra dates and the balance appears to bounce back. The correct approach is to calculate Starting Stock – Cumulative Demand per Part up to the current date, and then return BLANK() for dates after the last demand date of that part. This keeps the running balance continuous per part and stops the line exactly at the final work-order date, preventing any reset behavior.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.