Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Can someone please help with the attached. I am trying to calculate the Production and Closing inventry based on demand, safety stock and opening stock. The production & opening calculation is dependent on the closing inventory of the previous period. I get into a circular reference issue in power pivot.
Production = Demand + Safety Stock - Opening Inventory
Closing = opening + Production - Demand
Opening = closing of previous period except for 1st period.
Output expected:
Appreciate if anyone can help.
Hi,
To the best of my knowledge, this is circular logic even to a layperson (not an MS Excel user). Production depends up on the closing stock of the previuos month and closing stock of the previous month depends up on the production in that month. Even if you try to create formulas for this in an MS Excel file, how you will solve this. What will those formuals be?
Hello,
Implementing in excel is straightforward. The production and closing calculations for the first period is different from the remaining periods.
First Period Production Calculations
Second Period and onwards calculation
First period closing calculation
Second Period and onward closing calculations
Final overall desired output (production and closing and calculated data, rest are input data)
implementing this in excel is easy, but i am trying for a PBI solution as there are 100's of SKUs that I need to apply it to.
Thanks
OD
@Anonymous , You need to create measure like
Inventory / OnHand =
[Intial Inventory] + CALCULATE(SUM(Table[Ordered]),filter(date,date[date] <=maxx(date,date[date]))) - CALCULATE(SUM(Table[Sold]),filter(date,date[date] <=maxx(date,date[date]))) // [Intial Inventory] is measure
Inventory / OnHand =
CALCULATE(firstnonblankvalue('Date'[Month]),sum(Table[Intial Inventory]),all('Date')) + CALCULATE(SUM(Table[Ordered]),filter(date,date[date] <=maxx(date,date[date]))) - CALCULATE(SUM(Table[Sold]),filter(date,date[date] <=maxx(date,date[date])))
for opening
Inventory / OnHand =
CALCULATE(firstnonblankvalue('Date'[Month]),sum(Table[Intial Inventory]),all('Date')) + CALCULATE(SUM(Table[Ordered]),filter(date,date[date] <Minx(date,date[date]))) - CALCULATE(SUM(Table[Sold]),filter(date,date[date] <Minx(date,date[date])))
use date from date table in visual and slicer
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
68 | |
64 | |
50 | |
36 | |
26 |
User | Count |
---|---|
80 | |
57 | |
45 | |
44 | |
35 |