PowerBi cant be bound error

I made a query consisting of po header, po release, and vendor and imported this into sql via powerbi. I get a multipart identifier could not be bound error on po release only. What am i doing wrong? All joins are in place.

Let’s see your SQL.

If you’ve copied from the BAQ Designer (readable section) - it may not work correctly.

But as a start… lets see your SQL.

From the BAQ designer which is likely my problem then:

select
[PORel].[Plant] as [PORel_Plant],
[PODetail].[PartNum] as [PODetail_PartNum],
[Vendor].[Name] as [Vendor_Name],
[PODetail].[OpenLine] as [PODetail_OpenLine],
[PORel].[XRelQty] as [PORel_XRelQty],
(PORel.XRelQty - PORel.ReceivedQty) as [Calculated_OUTSTANDINGQTY],
[PORel].[ReceivedQty] as [PORel_ReceivedQty],
[PODetail].[UnitCost] as [PODetail_UnitCost],
(PODetail.UnitCost * PORel.XRelQty) as [Calculated_TOTALPRICE],
[PORel].[DueDate] as [PORel_DueDate],
[PORel].[PromiseDt] as [PORel_PromiseDt]
from Erp.PODetail as PODetail
left outer join Erp.Vendor as Vendor on
Vendor.Company = PODetail.Company
and Vendor.VendorNum = PODetail.VendorNum
where (PODetail.OpenLine = TRUE)
order by PORel.Plant Desc, Vendor.Name Desc, PORel.PONum Desc, PORel.POLine Desc, PORel.PORelNum Desc

Converted it to SQL for you.


SELECT
    PR.Plant AS PR_Plant,
    PD.PartNum AS PD_PartNum,
    V.Name AS V_Name,
    PD.OpenLine AS PD_OpenLine,
    PR.XRelQty AS PR_XRelQty,
    (PR.XRelQty - PR.ReceivedQty) AS OUTSTANDINGQTY,
    PR.ReceivedQty AS PR_ReceivedQty,
    PD.UnitCost AS PD_UnitCost,
    (PD.UnitCost * PR.XRelQty) AS TOTALPRICE,
    PR.DueDate AS PR_DueDate,
    PR.PromiseDt AS PR_PromiseDt
FROM Erp.PODetail AS PD
LEFT OUTER JOIN Erp.Vendor AS V ON
    V.Company = PD.Company
    AND V.VendorNum = PD.VendorNum
LEFT OUTER JOIN Erp.PORel AS PR ON
    PD.Company = PR.Company
    AND PD.PONum = PR.PONum
    AND PD.POLine = PR.POLine
WHERE PD.OpenLine = 1
ORDER BY
    PR.Plant DESC,
    V.Name DESC,
    PR.PONum DESC,
    PR.POLine DESC,
    PR.PORelNum DESC;

1 Like

You are AWESOME! Thanks!

Mark solution if youre happy.