Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
We we issue purchase orders on Dynamics 365, the purchase order lines contain a count of the number of units ordered (but not yet received). As folks do full or partial goods receipts, these are written to another table - saying how many were received and how many are still left to arrive. So i've built a table of the last receipt order lines, each of which tells me how many items are still on backlog. So in each purchase order line record, I have a new column "RemainingQty", which I set using:
Solved! Go to Solution.
Thank you - I managed to nest a second LOOKUPVALUE and job done - all working. Thank you.
Thank you - I managed to nest a second LOOKUPVALUE and job done - all working. Thank you.
@Anonymous
I'm happy you could solve it 👍.
Can you mark the post as solution, to make it easier for the person to find a solution in case of a similar issue?
If you have any questions let me know.
Best regards
Denis
Hey @Anonymous ,
why don't you just check if the LOOKUP gives you a result and otherwise give back the OrderedPurchaseQuantity:
RemainingQty =
VAR vAlreadyReceived =
LOOKUPVALUE(
Remaining[RemainingPurchaseQuantity],
Remaining[POandLine], PurchaseOrderLinesV2[POPlusLine],
0
)
VAR vOrdered =
MAX( PurchaseOrderLinesV2[OrderedPurchaseQuantity] )
RETURN
IF(
vAlreadyReceived <> BLANK(),
vAlreadyReceived,
vOrdered
)
Changed to:
RemainingQty =
VAR vAlreadyReceived =
LOOKUPVALUE(
Remaining[RemainingPurchaseQuantity],
Remaining[POandLine], PurchaseOrderLinesV2[POPlusLine],
0
)
VAR vOrdered =
MAX( PurchaseOrderLinesV2[OrderedPurchaseQuantity] )
RETURN
IF(
vAlreadyReceived <> 0,
vAlreadyReceived,
vOrdered
)
but that MAX() is giving the total for the whole column. Will put a second LOOKUPVALUE there methinks...