Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi there,
I currently have this table that I've created using Original Opening Stock and Closing Stock measures.
Besides Week Index 0, going forward from Week Index 1, I would like to have the Opening Stock for a week as the Closing Stock for the previous week. So for example, Week Index 2's Original Opening Stock should be equal to Week Index 1's Closing Stock.
Is there a way to acheive this without circular dependency errors?
The current DAX formula I have for the two measures are as follows:
Original Opening Stock:
CALCULATE(
SUM(Stock_CLEAN[Unrestricted PAC]),
Stock_CLEAN[Material] = SELECTEDVALUE(Stock_CLEAN[Material]),
Stock_CLEAN[Plnt] IN {"1100", "1500"}
)
Closing Stock:
[Opening Stock] - [Total Demand] + [Total Supply]
Solved! Go to Solution.
@k_r , Try using
Opening Stock =
VAR CurrentWeek = SELECTEDVALUE(Stock_CLEAN[Week Index])
VAR PreviousWeek = CurrentWeek - 1
VAR PreviousWeekClosingStock =
CALCULATE(
[Closing Stock],
Stock_CLEAN[Week Index] = PreviousWeek
)
RETURN
IF(
CurrentWeek = 0,
[Original Opening Stock],
PreviousWeekClosingStock
)
Proud to be a Super User! |
|
@k_r , Try using
Opening Stock =
VAR CurrentWeek = SELECTEDVALUE(Stock_CLEAN[Week Index])
VAR PreviousWeek = CurrentWeek - 1
VAR PreviousWeekClosingStock =
CALCULATE(
[Closing Stock],
Stock_CLEAN[Week Index] = PreviousWeek
)
RETURN
IF(
CurrentWeek = 0,
[Original Opening Stock],
PreviousWeekClosingStock
)
Proud to be a Super User! |
|
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |