dwoolaver75
New member
- Joined
- Apr 5, 2025
- Messages
- 2
- Reaction score
- 0
- Points
- 1
- Excel Version(s)
- Microsoft 365 Desktop V2502
Hello, I am trying duplicate the logic in these two formulas in either SQL PBI power query. As I look at the excel formulas I don't under how excel is NOT throwing a circular reference error. My efforts to duplicate these two column in power query and PBI/DAX are giving me circular reference errors (as I would expect)
Sums= =IF(LEFT([@REFTYPE],6)="Invent",SUMIFS([Sales Orders],[ITEMID],[@ITEMID],[REQDATE],"<"&[@[FINAL Best Before Date]])+SUMIFS([Forecast],[ITEMID],[@ITEMID],[REQDATE],"<="&[@[FINAL Best Before Date]])-SUMIFS([Quantity Allocation],[ITEMID],[@ITEMID],[FINAL Best Before Date],"<"&[@[FINAL Best Before Date]]),"")
Quantity Allocation=IF(LEFT([@REFTYPE],6)="Invent",IF([@Sums]>[@[On Hand]],[@[On Hand]],[@Sums]),"")


Sums= =IF(LEFT([@REFTYPE],6)="Invent",SUMIFS([Sales Orders],[ITEMID],[@ITEMID],[REQDATE],"<"&[@[FINAL Best Before Date]])+SUMIFS([Forecast],[ITEMID],[@ITEMID],[REQDATE],"<="&[@[FINAL Best Before Date]])-SUMIFS([Quantity Allocation],[ITEMID],[@ITEMID],[FINAL Best Before Date],"<"&[@[FINAL Best Before Date]]),"")
Quantity Allocation=IF(LEFT([@REFTYPE],6)="Invent",IF([@Sums]>[@[On Hand]],[@[On Hand]],[@Sums]),"")

