Hi am trying to write a dax query to create a calculated column to find the last date a transaction occurred.
My business logic is that for to select the max date for each customer create over a list of months where we have a positive transactions from that list (sometimes the customer does a returns/chargeback and that offsets the transactions they do that month)
(the data is being outputted into a table that has fields of: Customer Num & YYMM )
The Cash Transactions table has the following fields:
Customer Num,
Effective Date,
Payment Amount
YYMM (this is an internal field to track each month and year combo)
my issue is that my formula has a nested calculate statement on how I get the last transactions.
Here is the query I wrote...
=CALCULATE(MAX('Cash Tansactions'[Effective Date]),
FILTER('Cash Tansactions',EARLIER([Customer Num])='Cash Tansactions'[Customer Num]&&EARLIER([YYMM])='Cash Tansactions'[YYMM] ),
CALCULATE(sum('Cash Tansactions'[Payment Amount])>0,FILTER('Cash Tansactions',EARLIER([Customer Num])='Cash Tansactions'[Customer Num]&&EARLIER([YYMM])='Cash Tansactions'[YYMM]) )
)
My business logic is that for to select the max date for each customer create over a list of months where we have a positive transactions from that list (sometimes the customer does a returns/chargeback and that offsets the transactions they do that month)
(the data is being outputted into a table that has fields of: Customer Num & YYMM )
The Cash Transactions table has the following fields:
Customer Num,
Effective Date,
Payment Amount
YYMM (this is an internal field to track each month and year combo)
my issue is that my formula has a nested calculate statement on how I get the last transactions.
Here is the query I wrote...
=CALCULATE(MAX('Cash Tansactions'[Effective Date]),
FILTER('Cash Tansactions',EARLIER([Customer Num])='Cash Tansactions'[Customer Num]&&EARLIER([YYMM])='Cash Tansactions'[YYMM] ),
CALCULATE(sum('Cash Tansactions'[Payment Amount])>0,FILTER('Cash Tansactions',EARLIER([Customer Num])='Cash Tansactions'[Customer Num]&&EARLIER([YYMM])='Cash Tansactions'[YYMM]) )
)