Reputation: 55
I'm trying to create the calculated column 'TotalWeight' (table SP) based on 'Quantity' column (table SP) and 'Weight' column (table P). I can't figure it out, how to write expression. The one I tried doesn't work.
[SP.Quantity] * [P.Weight]
Upvotes: 1
Views: 66
Reputation: 11625
You have two options. First you could convert the table to a view in the database and do the join there. However if you prefer to do this in the DSV some syntax like the following will work. Not knowing your exact table names I guessed and hope you can extrapolate to your table names. Let’s call p the Product table. And let’s call sp the SupplierProduct table which is where you are putting the calculated column.)
Change the calculated column definition to:
Quantity * (select P.Weight from Product p where p.ProductID = SupplierProduct.ProductID)
Upvotes: 2