- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Opening Stock Position Measure Calculation
Hello!
I am trying to create a measure that will show cumulative opening stock position in a matrix table but finding it challenging.
The measure should sum the opening stock balance by taking the Opening stock value from the previous month, then use values currently in 2 linked tables :
Add Purchase Order Qty
Subtract Forecast Qty
The starting value for the measure can be a measure 'Current month closing stock' which is a sum of current inventory, + Purchase Order Qty, - Forecast Qty for current month.
Nov-23 | Dec-23 | Jan-24 | Feb-24 | |
Current stock | 500 | |||
Forecast Sales | - 100 | - 100 | - 100 | - 100 |
Open Orders | + 50 | +50 | + 50 | + 50 |
Current month Closing stock | 450 | |||
MEASURE: Opening Stock = (Opening stock value from prev Month) + Open Orders - Forecast Sales | 450 | 400 | 350 |
Many thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @nthomson ,
Is that how your data is formatted - there's a separate column for each month? If so you need to unpivot your table first before doing any and create a date equivalent of your months (if they are a text string) before doing any calcuation. Your imported data should look like below:
And for your opening and closing stock measures:
Opening Stock =
CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
ALL ( 'Table'[Date], 'Table'[Period] ),
'Table'[Date] < MAX ( 'Table'[Date] )
)
)
Closing stock can be alternatively written as below since it is just cumulative sum of all inventory values.
Closing Stock =
CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
ALL ( 'Table'[Date], 'Table'[Period] ),
'Table'[Date] <= MAX ( 'Table'[Date] )
)
)
Please see attached pbix for your reference.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi,
I have solved similar problem in the 2 attached PBI files. Please study them and apply those formulas to your dataset.
Hope this helps.
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
12-18-2023 03:57 AM | |||
09-04-2024 12:58 PM | |||
08-20-2024 09:13 AM | |||
09-27-2024 05:56 AM | |||
06-26-2024 11:51 PM |
User | Count |
---|---|
85 | |
74 | |
68 | |
51 | |
30 |
User | Count |
---|---|
115 | |
109 | |
71 | |
65 | |
39 |