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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Referencing same column | inventory calculations | closing and opening inventory

I have a requirement to create an inventory forecast by month table where:

InventoryClosing = InventoryOpening + Re-supply - Demand

 

However, when the demand is higher than InventoryOpening + Re-supply, total inventory should become zero and not negative.  current month's InventoryOpening = last month's InventoryClosing  (InventoryOpening at the start of the period is given)

 

My Data Table:

ShanWee_0-1661841919094.png

 

 

My Result columns should look like:

ShanWee_1-1661841485123.png

 

Trying to calculate InventoryClosing using InventoryOpening results a circular reference.
Could not use the cumulating demand and re-supply due to negative inventory values.

Any reccomondation/s would be much appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

like this?

vmengzhumsft_0-1662087842481.png

If this can meet your needs, try this measure:

closing inventory = var _value= SUMX(FILTER(ALL('Table'),'Table'[Index]<=MAX('Table'[Index])),'Table'[re-supplied]-'Table'[sales demand])+3500
return if(_value<0,0,_value)

and this is my pbix file for you to refer.

 

Best regards,

Community Support Team Selina zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

like this?

vmengzhumsft_0-1662087842481.png

If this can meet your needs, try this measure:

closing inventory = var _value= SUMX(FILTER(ALL('Table'),'Table'[Index]<=MAX('Table'[Index])),'Table'[re-supplied]-'Table'[sales demand])+3500
return if(_value<0,0,_value)

and this is my pbix file for you to refer.

 

Best regards,

Community Support Team Selina zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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