BernerDogs12

New Member
Joined
Apr 10, 2017
Messages
1
Hey All,

I have two data tables linked by Sale number. Let's say the data looks like this:

Sale NumberSale Date
1234501/01/2016
2345602/02/2016
3456703/03/2016
4567804/04/2016

<tbody>
</tbody>

Sale NumberChange Date
1234501/02/2016
1234501/08/2016
1234501/20/2016
2345602/08/2016
3456703/09/2016
4567804/21/2016

<tbody>
</tbody>


As show, each sale number has only one sale date, but each sale number could have multiple change dates, which shows changes to overall revenue after sale.

I'm trying to pull changes to revenue by maturity and have the data tables (both pulling from the same SQL server) linked by a relationship between Sale number on both.

I'm trying to write a formula in a calculated column that will show how many days after the sale a change was made (Change Date-Sale Date) but I'm getting an error. It goes to say this spreadsheet is being designed for people who aren't good with excel, so I can't explore options outside a calculated column.

Please help!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
If Table1 is Sales No & Sale Date, and Table2 is Sales No & Change date: If in Excel - I would perform a lookup on Table2 (from Table1) to see if it can find a SALE Date...if it does, place that date in the 2nd column in the SALES TABLE ( Headings would look like this: Col A= SalesNumber; Col B = SaleDate (lookup); Col C = ChangeDate; Col D = DateDif). If there is no lookup value for - make it '0', otherwise put the lookup value in Table2...I then used the DateDif formula to compute the number of days between the 2 dates [ =datedif(salesDate, ChangeDate, "D" ; where D stands for the number of days between the 2 points (note: smaller date value MUST come before the Larger date value!]
 
Upvote 0
Which change date do you want to compare to the Sale Date? The last one listed? If these two tables are only ones in the model, you can try as a Calculated Column in the Sales table like this:

Code:
=VAR LastChangeDate =
    LASTDATE ( RELATEDTABLE ( ChangeTable[Change Date] ) )
RETURN
    LastChangeDate - Sale[Sale Date]

or in the Change table like this:

Code:
= ChangeTable[Change Date] - RELATED ( Sale[Sale Date] )
 
Upvote 0

Forum statistics

Threads
1,214,817
Messages
6,121,717
Members
449,050
Latest member
MiguekHeka

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