So let’s assume for the sake of simplicity the following table:
Two PurchaseOrder Numbers, with granularity on Transactions (not a sequence) representing when the Open Quantity (OpenQty) changes.
The idea is to now add another column which takes the latest (by Posting Date), smallest OpenQty for the PurchaseOrder and repeats them for all Transactions.
Like so:
My measure sorts the table by Posting Date and OpenQty and takes the top value. I ignores the other slicers with an ALLEXCEPT.
LatestOpenQty =
CALCULATE(
MINX(
TOPN(1,FILTER(PurchaseOrder,PurchaseOrder[OpenQty]>=0),
PurchaseOrder[PostingDate],DESC,
PurchaseOrder[OpenQty],ASC),
MIN(PurchaseOrder[OpenQty])),
ALLEXCEPT(PurchaseOrder,PurchaseOrder[PurchaseOrder]),
PurchaseOrder[OpenQty]>=0)
Although I have this working, it is part of a very large dataset and I feel like I am not using the most optimal approach.
Any advice?
Sample File:
LatestOpenQty.pbix (23.9 KB)