Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello Everyone,
| Session Date | Count of Stock | Previous Day Count The Result I Need |
| January 5, 2022... | 11 | |
| January 10, 2022... | 17 | 11 |
| January 12, 2022... | 26 | 17 |
| January 17, 2022... | 25 | 26 |
| January 19, 2022... | 52 | 25 |
| January 24, 2022... | 92 | 52 |
| January 26, 2022... | 12 | 92 |
| January 31, 2022... | 49 | 12 |
| February 2, 2022... | 53 | 49 |
| February 7, 2022... | 58 | 53 |
| February 9, 2022... | 64 | 58 |
Date is not daily occured, so basically amount should be nearest previous date's stock count.
Hope it make sence to you who are reading this.
Thanks in Advance.
Solved! Go to Solution.
Hi @ddpl
I assume that Count of Stock is a measure not a summarized column, otherwise just create a simple count measure. You may then use
Previous Day Count =
VAR CurrentDate =
SELECTEDVALUE ( TableName[Session Date] )
VAR PreviousRecords =
FILTER ( ALL ( TableName ), TableName[Session Date] < CurrentDate )
VAR PreviousDate =
MAXX ( PreviousRecords, TableName[Session Date] )
RETURN
CALCULATE ( [Count of Stock], TableName[Session Date] = PreviousDate )
Hi @ddpl
I assume that Count of Stock is a measure not a summarized column, otherwise just create a simple count measure. You may then use
Previous Day Count =
VAR CurrentDate =
SELECTEDVALUE ( TableName[Session Date] )
VAR PreviousRecords =
FILTER ( ALL ( TableName ), TableName[Session Date] < CurrentDate )
VAR PreviousDate =
MAXX ( PreviousRecords, TableName[Session Date] )
RETURN
CALCULATE ( [Count of Stock], TableName[Session Date] = PreviousDate )
Add a calculated column:
VAR maxDate =
CALCULATE(
MAX(yourTable[Session Date]),
FILTER(
yourTable,
yourTable[Session Date] < EARLIER(yourTable[Session Date])
)
)
RETURN
CALCULATE(
MAX(yourTable[Count of Stock]),
yourTable[Session Date] = maxDate
)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.