Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a database of account transactions, each transaction has an overdue element (or blank) e.g.
Date | Account | Element | Value | Overdue |
31-Mar-19 | Jack | Pmt Due | 250.00 | |
1-Apr-19 | Jack | Pmt Received | -50 | (50.00) |
2-Apr-19 | Jack | Statement Fee | 12 | |
1-May-19 | Jack | Pmt Received | -50 | (50.00) |
The total overdues can be calculated using the cumulative pattern:
Overdue balance := CALCULATE ( SUM ( Transactions[Overdue] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX( 'Date'[Date] ) ) )
I want to find the balance which is more than 30 days overdue in the current context. E.g. On 1 Apr this account had $150 which was more than 30 days overdue.
Solved! Go to Solution.
try these:
TOTAL OVERDUE = CALCULATE( SUM( FactAccountTransaction[Overdue]), FILTER( DimDate, MAX(DimDate[Date]) >= DATEADD( DimDate[Date], -30, DAY )) ) Total OverDue RT = IF( COUNTROWS(FactAccountTransaction) >=1, CALCULATE( [TOTAL OVERDUE], FILTER( ALL( DimDate), MAX( DimDate[Date]) >= DimDate[Date]) ) )
Should be relatively easy, just not seeing how you are getting 150 for April first though. What would the value be on April 2nd and May 1st?
@pistachio how did you get $150 as overdue on April 01 for account Jack. Numbers doesn't adds up, may be you showed partial data?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Sorry I got my months mixed up. The account was $150 overdue on 1 May ($250 expected less $100 received since).
That makes more sense 🙂
I did this by these two measures:
TOTAL OVERDUE = CALCULATE( SUM( Table1[Overdue]), FILTER( Table1, MAX( Table1[Date]) >= DATEADD( Table1[Date], -30, DAY )) ) Total OverDue RT = CALCULATE( [TOTAL OVERDUE], FILTER( ALL( Table1), MAX( Table1[Date]) >= Table1[Date]))
You will want to have a Calendar table that is related to your fact table though and use the dates from the Calendar table for your rows and in the filter arguments above
Thank you for your quick response but I'm having trouble understanding and implementing this and translating to my table names, particularly the circular date filters in your example.
I do have a date table. These formulas are coming up with a hugely negative value
// Does this sum overdues in the last 30 days?
BankOD30 = CALCULATE ( SUM ( FactAccountTransaction[Overdue] ), FILTER ( FactAccountTransaction, MAX ( FactAccountTransaction[DatePosted] ) >= DATEADD ( FactAccountTransaction[DatePosted], -30, DAY ) ) )
// Sums 30+ overdues for all time periods
BankOD RT =
CALCULATE (
[BankOD30],
FILTER (
ALL ( FactAccountTransaction ),
FactAccountTransaction[DatePosted] <= LASTDATE ( DimDate[Date] )
)
)
try these:
TOTAL OVERDUE = CALCULATE( SUM( FactAccountTransaction[Overdue]), FILTER( DimDate, MAX(DimDate[Date]) >= DATEADD( DimDate[Date], -30, DAY )) ) Total OverDue RT = IF( COUNTROWS(FactAccountTransaction) >=1, CALCULATE( [TOTAL OVERDUE], FILTER( ALL( DimDate), MAX( DimDate[Date]) >= DimDate[Date]) ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |