Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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! |
|
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
13 | |
12 | |
10 | |
7 | |
7 |
User | Count |
---|---|
18 | |
14 | |
11 | |
11 | |
10 |