Filtering a specific date and getting the sales amount

LBala

New Member
Joined
Apr 3, 2014
Messages
22
Hi all;
I am working with a power pivot report with two tables (SalesFact and Calendar) and need to get the amount sold of an item in the corresponding date a year ago. The two tables look like this:

SalesFact table:
ItemSaleDateSoldAmount
Banana01/02/2014$3.00
Pear01/05/2014$10.00
Banana01/01/2015$5.00
Pear01/04/2015$4.00

<tbody>
</tbody>

Calendar table:
YearDateMatchingDateLastYear
201501/01/201501/02/2014
201501/02/201501/03/2014
201501/03/201501/04/2014
201501/04/201501/05/2014

<tbody>
</tbody>

The tables are connected by the columns SaleDate (SalesFact table) and Date (calendar table).

I need to create a pivot table with a calculated field to get the "SoldAmount" value of an item in the "MatchingDateLastYear". The name of this calculated field is "MatchingDateLastYearSoldAmount", below is an example of the pivot table with this calculated field results:

Year filtered in the pivot table: 2015

ItemSaleDateSoldAmountMatchingDateLastYearSoldAmount
Banana01/01/2015$5.00$3.00
Pear01/04/2015$4.00$10.00

<tbody>
</tbody>

Here is the explanation of the results under "MatchingDateLastYearSoldAmount" above:

By filtering the year 2015 the pivot table displays the following:

1) "Banana", sold on 01/01/2015, amount of $5.00. The "MatchingDateLastYear" for 01/01/2015 in the calendar table is 01/02/2014 and on that date the banana "SoldAmount" is $3.00 in the SalesFact table.

2) "Pear", sold on 01/04/2015, amount of $4.00. The "MatchingDateLastYear" for 01/04/2015 in the calendar table is 01/05/2014 and on that date the pear "SoldAmount" is $10.00 in the SalesFact table.

I am having difficulties figuring out how to create the calculated field "MatchingDateLastYearSoldAmount". Any help will be appreciated.

Thanks.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Matt, this article was an excellent guide to the solution, it was very well explained.
I am using a variation of the "CALCULATE([Total Sales],DATESADD(Calendar[Dates],-1,YEAR))".
Thank you very much.
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,927
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top