Forum Discussion
Calculation involving multiple table relationships
I am facing a problem in trying to perform a calculation involving multiple tables. This is the scenario -
- Table [SKU Master] contains SKU and Absolute Weight of a product
- Table [Consignment Cost] contains Consignment ID and Consignment Cost - stores cost for each consignment
- Table [Consignment SKU] contains Consignment ID, SKU and Quantity (which SKU was shipped in which Consignment and number of units shipped)
- Table [Sales Tx] is the fact table where I need to calculate the Transportation Cost (for a combination of SKU and Consignment)
In the [Consignment SKU] table I calculate the Transportation Cost based on the weight ratio (absolute weight of the SKU / absolute weight for each SKU in the same consignment * quantity ). I did this using a calculated column -
5 Replies
- kentyler
Solution Sage
It looks like the table labeled "Sales Tx" is actually about orders.
You have a 1 to many relationship between the Consignment SKU table and the Sales Tx(Orders) table.
Is it that one Consignment SKU go in many Orders ?
- msingh2019
Helper II
Yes, one Consignment SKU goes into many orders. The Sales Tx table represents customer orders and how each order is fulfilled (which SKU from which Consignment). The Quantity column in the Consignment SKU table defines how many units of one SKU in a particular Consignment. I hope this makes sense.
- v-diye-msft
Community Support
- kentyler
Solution Sage
Looking at you power bi file, it looks like you already have a relationship between Consignment SKU and Sales Tx on the Consignment SKU column... so it makes it confusing to understand your problem.
"[Sales Tx] >> [Consignment SKU] via ConsignmentSKU which Power BI is not allowing to build an active relationship."
- msingh2019
Helper II
If you look at my pbix file you will notice that the relationship between Sales Tx and Consignment SKU (via the ConsignmentSKU column) is not active. I tried making the relationship active but Power BI is not allowing this direct relationship because that will introduce ambiguity between SKU Master and Sales Tx.
The reason why I need the relationship between Consignment SKU and SKU Master is I need the Absolute Weight in Consignment SKU. Is there any way I can pull the Absolute Weight into Sales Tx then indirectly looking up from there into Consignment SKU? Note that the Absolute Weight is at SKU level. If that works then problem is solved.