Hi,
I just installed powerpivot yesterday thinking that it might be able to solve a problem that I am facing.
Also, I am not sure whether the task I am looking at doing is even achievable in powerpivot.
I have two tables. Master and Sub. Both of which are hundreds of thousands of rows.
The objective is to compare Master and Sub, and subtract the quantity from master if the the date, period and price matches.
Master looks like the following:
Date can range from 1 sep to 30 sep.
Period can range from 1 to 48.
Price can be positive or negative and can be any price.
Quantity can be any positive number.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Period[/TD]
[TD]Price[/TD]
[TD]Quantity[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]20[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]25[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]30[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]40[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]60[/TD]
[TD]80[/TD]
[/TR]
</tbody>[/TABLE]
And Sub looks like the following:
Date can range from 1 sep to 30 sep.
Period can range from 1 to 48.
Price can be positive or negative and can be any price.
Quantity can be any positive number.
In addition, there maybe multiple rows with the same date, period and price but different quantity.
There are prices that appear in master but do not appear in sub.
There are also multiple redundant price 0, quantity 0 rows in sub.
Quantity in sub may be less than or equal to master if the date, period and price match master.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Period[/TD]
[TD]Price[/TD]
[TD]Quantity[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]25[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]40[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]60[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]60[/TD]
[TD]15[/TD]
[/TR]
</tbody>[/TABLE]
Objective table is as follows:
If quantity for any row is reduced to zero, ideally entire row is removed, but reducing quantity to zero should be fine as well.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Period[/TD]
[TD]Price[/TD]
[TD]Quantity[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]70[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]20[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]25[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]30[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]60[/TD]
[TD]45[/TD]
[/TR]
</tbody>[/TABLE]
What I attempted so far:
I created a new column each for the master and sub tables by concatenating the date, period and price columns so as to come up with a column filled with 1-Sep-2014-1-4 kind of data. I wanted to use this column to establish a relationship between the master and sub tables. After which, I thought I might be able to just subtract the quantities away but it turns out I get an error when i try a = MASTER[Quantity]-Related(SUB[Quantity]).
Please advise.
Thank you.
I just installed powerpivot yesterday thinking that it might be able to solve a problem that I am facing.
Also, I am not sure whether the task I am looking at doing is even achievable in powerpivot.
I have two tables. Master and Sub. Both of which are hundreds of thousands of rows.
The objective is to compare Master and Sub, and subtract the quantity from master if the the date, period and price matches.
Master looks like the following:
Date can range from 1 sep to 30 sep.
Period can range from 1 to 48.
Price can be positive or negative and can be any price.
Quantity can be any positive number.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Period[/TD]
[TD]Price[/TD]
[TD]Quantity[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]20[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]25[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]30[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]40[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]60[/TD]
[TD]80[/TD]
[/TR]
</tbody>[/TABLE]
And Sub looks like the following:
Date can range from 1 sep to 30 sep.
Period can range from 1 to 48.
Price can be positive or negative and can be any price.
Quantity can be any positive number.
In addition, there maybe multiple rows with the same date, period and price but different quantity.
There are prices that appear in master but do not appear in sub.
There are also multiple redundant price 0, quantity 0 rows in sub.
Quantity in sub may be less than or equal to master if the date, period and price match master.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Period[/TD]
[TD]Price[/TD]
[TD]Quantity[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]25[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]40[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]60[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]60[/TD]
[TD]15[/TD]
[/TR]
</tbody>[/TABLE]
Objective table is as follows:
If quantity for any row is reduced to zero, ideally entire row is removed, but reducing quantity to zero should be fine as well.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Period[/TD]
[TD]Price[/TD]
[TD]Quantity[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]70[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]20[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]25[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]30[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1-Sep-2014[/TD]
[TD]1[/TD]
[TD]60[/TD]
[TD]45[/TD]
[/TR]
</tbody>[/TABLE]
What I attempted so far:
I created a new column each for the master and sub tables by concatenating the date, period and price columns so as to come up with a column filled with 1-Sep-2014-1-4 kind of data. I wanted to use this column to establish a relationship between the master and sub tables. After which, I thought I might be able to just subtract the quantities away but it turns out I get an error when i try a = MASTER[Quantity]-Related(SUB[Quantity]).
Please advise.
Thank you.