tanquoc0309
New Member
- Joined
- Aug 16, 2013
- Messages
- 27
I have problem with relationship
SALE:
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Store[/TD]
[TD]Pro Code[/TD]
[TD]QTy[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA11[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]BB11[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]AA11[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]BB11[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]BB11[/TD]
[TD]6[/TD]
[/TR]
</tbody>[/TABLE]
BOMTECHNICAL
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Pro Code[/TD]
[TD]Material Name[/TD]
[TD]Weight[/TD]
[/TR]
[TR]
[TD]AA11[/TD]
[TD]M1[/TD]
[TD]0.1[/TD]
[/TR]
[TR]
[TD]AA11[/TD]
[TD]M2[/TD]
[TD]0.5[/TD]
[/TR]
[TR]
[TD]AA11[/TD]
[TD]M3[/TD]
[TD]0.5[/TD]
[/TR]
[TR]
[TD]AA11[/TD]
[TD]M4[/TD]
[TD]0.6[/TD]
[/TR]
[TR]
[TD]BB11[/TD]
[TD]M1[/TD]
[TD]0.7[/TD]
[/TR]
[TR]
[TD]BB11[/TD]
[TD]M5[/TD]
[TD]0.8[/TD]
[/TR]
</tbody>[/TABLE]
MATERIALCOST
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Material Name[/TD]
[TD]MaterialName-Child[/TD]
[TD]Cost[/TD]
[/TR]
[TR]
[TD]M1[/TD]
[TD]M1_1[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]M1[/TD]
[TD]M1_2[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]M2[/TD]
[TD]M2_1[/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]M2[/TD]
[TD]M2_2[/TD]
[TD]150[/TD]
[/TR]
[TR]
[TD]M3[/TD]
[TD]M3_1[/TD]
[TD]400[/TD]
[/TR]
[TR]
[TD]M3[/TD]
[TD]M3_3[/TD]
[TD]700
[/TD]
[/TR]
</tbody>[/TABLE]
ACTUAL
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Store[/TD]
[TD]MaterialName-Child[/TD]
[TD]Qty[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]M1_1[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]M2_1[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]M2_2[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]M3_3[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]M1_1[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]M2_2[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]M2_1[/TD]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]
How can I have pivot as below:
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Store[/TD]
[TD]Pro Code[/TD]
[TD]Material Name[/TD]
[TD]Weight_Sale[/TD]
[TD]Material Cost[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA11[/TD]
[TD]M1[/TD]
[TD]= Weight in BOM * Qty in Sale[/TD]
[TD]=Weight_Sale * Qty of Actual * COST[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]M2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]M3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]M4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]BB11[/TD]
[TD]M1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]M5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Can i have pivot as above??
SALE:
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Store[/TD]
[TD]Pro Code[/TD]
[TD]QTy[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA11[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]BB11[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]AA11[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]BB11[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]BB11[/TD]
[TD]6[/TD]
[/TR]
</tbody>[/TABLE]
BOMTECHNICAL
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Pro Code[/TD]
[TD]Material Name[/TD]
[TD]Weight[/TD]
[/TR]
[TR]
[TD]AA11[/TD]
[TD]M1[/TD]
[TD]0.1[/TD]
[/TR]
[TR]
[TD]AA11[/TD]
[TD]M2[/TD]
[TD]0.5[/TD]
[/TR]
[TR]
[TD]AA11[/TD]
[TD]M3[/TD]
[TD]0.5[/TD]
[/TR]
[TR]
[TD]AA11[/TD]
[TD]M4[/TD]
[TD]0.6[/TD]
[/TR]
[TR]
[TD]BB11[/TD]
[TD]M1[/TD]
[TD]0.7[/TD]
[/TR]
[TR]
[TD]BB11[/TD]
[TD]M5[/TD]
[TD]0.8[/TD]
[/TR]
</tbody>[/TABLE]
MATERIALCOST
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Material Name[/TD]
[TD]MaterialName-Child[/TD]
[TD]Cost[/TD]
[/TR]
[TR]
[TD]M1[/TD]
[TD]M1_1[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]M1[/TD]
[TD]M1_2[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]M2[/TD]
[TD]M2_1[/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]M2[/TD]
[TD]M2_2[/TD]
[TD]150[/TD]
[/TR]
[TR]
[TD]M3[/TD]
[TD]M3_1[/TD]
[TD]400[/TD]
[/TR]
[TR]
[TD]M3[/TD]
[TD]M3_3[/TD]
[TD]700
[/TD]
[/TR]
</tbody>[/TABLE]
ACTUAL
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Store[/TD]
[TD]MaterialName-Child[/TD]
[TD]Qty[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]M1_1[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]M2_1[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]M2_2[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]M3_3[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]M1_1[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]M2_2[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]M2_1[/TD]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]
How can I have pivot as below:
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Store[/TD]
[TD]Pro Code[/TD]
[TD]Material Name[/TD]
[TD]Weight_Sale[/TD]
[TD]Material Cost[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA11[/TD]
[TD]M1[/TD]
[TD]= Weight in BOM * Qty in Sale[/TD]
[TD]=Weight_Sale * Qty of Actual * COST[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]M2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]M3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]M4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]BB11[/TD]
[TD]M1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]M5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Can i have pivot as above??