Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
99 | |
76 | |
67 | |
61 |
User | Count |
---|---|
142 | |
106 | |
103 | |
85 | |
70 |