Using SSAS Tabular or Excel PowerPivot, I'm looking for a DAX formula to achieve the following:
I have a transactions table with 3 main columns: Date, Type and Amount
Type can be: 'Sale' or 'Payment'.
What I need is to get my new calculated field, the "Payment date" of each Sale, so my formula should look something like:
CALCULATE FIRST(Date), filter(type='payment'), filter(currentrow(date) <= payment(date)))
Need some help to find the correct date filter. It's also important that I find only the first transaction of type 'Payment', as there can be further transacations.
Example data: PaymentDate is my calculated field
Type Date Amount PaymentDate
Sale 01/01/2016 100 31/02/2016
Sale 01/02/2016 100 31/02/2016
Sale 01/03/2016 100 31/05/2016
Payment 31/02/2016 200 Empty
Sale 01/04/2016 100 31/05/2016
Sale 01/05/2016 100 31/05/2016
Payment 31/05/2016 300 Empty
Sale 01/06/2016 100 Empty
Payment date
is the next date of type Payment, right? – alejandro zuleta