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
AnAnalyst
Helper III
Helper III

Inventory Tracking and Order Fulfillment

I'm stuggling with creating a data model and calculations that answer the following questions:


1. What Orders Numbers will I not be able to fulfill in the future due to lack of stock. (Current Stock - Customer Orders + Purchases = Ending Stock)

2. When will I be able to fill those orders based on purchases from suppliers (Back in stock date)?

 

I've attached a data model with sample data: https://1drv.ms/u/s!Aj5qeXmPp-hpjxbgnSDTmhj7bwi8?e=O92bum

 

Example Pic.PNG

 

Any help is very much appreciated. 

3 REPLIES 3
grantsamborn
Solution Sage
Solution Sage

Hi @AnAnalyst 

 

Your measure [Sum of Ending Stock] in your model doesn't seem to work.

 

Would something like this help?

 

 

zBalance = 
VAR _CurrentStock =
    CALCULATE(
        SUM( 'Current Stock'[Current Stock] ),
        FILTER(
            ALL( 'Date' ),
            'Date'[Date] <= MAX( 'Date'[Date] )
        )
    )
VAR _CustomerOrders =
    CALCULATE(
        SUM( 'Customer Orders'[Order Quantity] ),
        FILTER(
            ALL( 'Date' ),
            'Date'[Date] <= MAX( 'Date'[Date] )
        )
    ) * -1
VAR _SupplierOrders =
    CALCULATE(
        SUM( 'Supplier Orders'[Quantity] ),
        FILTER(
            ALL( 'Date' ),
            'Date'[Date] <= MAX( 'Date'[Date] )
        )
    )
VAR _Total = _CurrentStock + _CustomerOrders + _SupplierOrders
RETURN
    _Total

 

 

Let me know if this helps or if you have any questions.

 

Added:

Regarding you questons...

1.  Any time [zBalance] is less than 0 would indicate a lack of stock.

2.  I'm not sure of your company's procedures/rules but I think that might take a little more work.

 

Sorry I had to add this.  After re-reading I realized that you had other requiements besides the running balance.

The above measure will show a line for every date.

You would also probably want a measure like this so that can filter your table.

 

_Display = IF( ISBLANK( [Sum of Current Stock] + [Sum of Customer Orders] + [Sum of Supplier Orders] ),  0,  1 )

 

AnAnalyst
Helper III
Helper III

Let me know if there are any other details I can provide.

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.