Forum Discussion
Aggregate across different timelines
- 1 year ago
Hi RenierP ,
Thank you for reaching out to the Microsoft Community Forum.
DAX measure
LastQty =
VAR CurrentSKU = SELECTEDVALUE(Stock[SKU])
VAR LastDate =
CALCULATE(
MAX(Stock[Date]),
FILTER(
ALL(Stock),
Stock[SKU] = CurrentSKU &&
Stock[Date] <= MAX(Calendar[Date])
)
)
RETURN
CALCULATE(
MAX(Stock[QTY]),
Stock[SKU] = CurrentSKU &&
Stock[Date] = LastDate
)
Note:
ALL(Stock) removes filters on the stock table to get a reliable max date. We re-apply the filter manually for the current SKU. It ensures we're always calculating the latest known stock per SKU, up to the current Calendar[Date].TotalStock Measure :
TotalStock =
SUMX(
VALUES(Stock[SKU]),
[LastQty]
)
Note : This will iterate over each SKU, get its last known quantity, and sum them.Use Calendar[Date] on the X-axis. Plot TotalStock. Add a slicer for SKU .
If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.
Thank you
Hi RenierP ,
Thank you for reaching out to the Microsoft Community Forum.
If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.
Thank you
HI RenierP ,
Thank you for reaching out to the Microsoft Community Forum.
If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.
Thank you
- v-dineshya1 year agoCommunity Support
Hi RenierP ,
Thank you for reaching out to the Microsoft Community Forum.
If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.
Thank you