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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ekoland88
Frequent Visitor

Forecast coverage vs stock

I need your help

I have some forecast values: Dec:323, Nov:346. October:321 and some stock value 616.

I need a measure that calculates how many months I can cover with the current stock.

The answer on this particular case is 1,87 months.

Please help!

2 REPLIES 2
v-zhenbw-msft
Community Support
Community Support

Hello @ekoland88 ,

What is the structure of your table?

If the table structure is so, you can test the following measure.

F1.jpg

Measure = 
var _not_stock_value = CALCULATE(SUM('Table'[values]),FILTER('Table','Table'[forecast]<>"stock"))
var _not_stock_count = CALCULATE(DISTINCTCOUNT('Table'[forecast]),FILTER('Table','Table'[forecast]<>"stock"))
var _stock_value = CALCULATE(SUM('Table'[values]),FILTER('Table','Table'[forecast]="stock"))
return
DIVIDE(
    _stock_value,
    DIVIDE(_not_stock_value,_not_stock_count))

F2.jpg

If you don't meet your requirements, could you show the exact expected result based on the table we shared?

Best regards

Community support team _ zhenbw

If this post helps,then consider Accepting it as the solution to help other members find it faster.

BTW, pbix as an attachment.

amitchandak
Super User
Super User

@ekoland88 , there is a post By Greg on this. See if that can help

https://community.powerbi.com/t5/Quick-Measures-Gallery/Days-of-Supply/td-p/635656

or this

https://radacad.com/calculating-stock-on-hand-using-dax-power-bi-inventory-model

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.