Forum Discussion
DAX help - Accounts Receivable Aging
- 8 years ago
Unfortunately that did not work. But luckily I stumbled on a formula that works. Here it is in case anyone is interested. I'd be happy to hear any suggestions as to improvements to this formula if any exist.
Total AR 0-30 =
VAR EndDate =
MAX ( 'Calendar'[Date] )
RETURN
IF (
MIN ( 'Calendar'[Date] )
<= CALCULATE ( MAX ('TransactionsTable'[PostingDate]), ALL ('TransactionsTable') ),
CALCULATE (
SUM ( 'TransactionsTable'[TransactionAmount] ),
FILTER ( ALL ( 'Calendar'[Date] ), 'Calendar'[Date] <= EndDate ),
KEEPFILTERS (
IFERROR (
DATEDIFF ( CustomerTable[CustomerCheckoutDate], EndDate, DAY ),
( DATEDIFF ( EndDate, CustomerTable[CustomerCheckoutDate], DAY ) ) * -1
)
< 31
)
)
)
hmm, can you try this?
LessThan31 =
VAR DaysOverdue =
ADDCOLUMNS (
Transactions,
"DaysOverdue", Transactions[CustomerCheckoutDate] - Transactions[Transaction Date]
)
VAR LessThan31 =
FILTER ( DaysOverdue, [DaysOverdue] < 31 )
RETURN
CALCULATE ( SUM ( Transactions[Transaction Amount] ), LessThan31 )I wasn't clear whether you need to calculate the days on row level (current syntax) or grouped per Account/Account&Item, if grouping is possible then Summarize could replace whole Transactions table
Also the problem becones very easy once you add calculated column for
Transactions[CustomerCheckoutDate] - Transactions[Transaction Date]
the question is whether it makes sense from aggregation angle
Unfortunately that did not work. But luckily I stumbled on a formula that works. Here it is in case anyone is interested. I'd be happy to hear any suggestions as to improvements to this formula if any exist.
Total AR 0-30 =
VAR EndDate =
MAX ( 'Calendar'[Date] )
RETURN
IF (
MIN ( 'Calendar'[Date] )
<= CALCULATE ( MAX ('TransactionsTable'[PostingDate]), ALL ('TransactionsTable') ),
CALCULATE (
SUM ( 'TransactionsTable'[TransactionAmount] ),
FILTER ( ALL ( 'Calendar'[Date] ), 'Calendar'[Date] <= EndDate ),
KEEPFILTERS (
IFERROR (
DATEDIFF ( CustomerTable[CustomerCheckoutDate], EndDate, DAY ),
( DATEDIFF ( EndDate, CustomerTable[CustomerCheckoutDate], DAY ) ) * -1
)
< 31
)
)
)
- v-huizhn-msft8 years agoMicrosoft Employee
Hi robarivas,
Congratulations, please mark your reply as answer, so more people will benefit from here.
Thanks,
Angelia