Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hi,
I need to sum up the invoice amounts from my fact_invoice table, based on overdue days, the challenge is the overdue days calculation is dynamic based on user's date selection of Dim_SlicerDate.
I have created a measure below to sum up invoice amounts with overdue days between 31-60 days. It works on invoice level (see printscreen below). However, it won't work if I use the measure on legal entitiy level. The issue is in each entity, there are mulple invoices, hence my var overdue_days calculation is not correct.
Solved! Go to Solution.
Perhaps a different approach. Write a measure, if you don't have one, which calculates the amount due at an invoice level, and includes all your logic about currency conversion. The basic concept would be SUMX('Invoice Table', 'Invoice Table'[Amount]).
Rather than trying to calculate the number of days overdue for each invoice, work out the start and end date of your 31-60 day window, and then use DATESBETWEEN. The basic concept would be
Overdue 31-60 days =
var endDate = SELECTEDVALUE('Date slicer'[Date])
var startDate = endDate - 30
RETURN CALCULATE( [Invoice Amount], DATESBETWEEN('Date'[Date], startDate, endDate ) )
Perhaps a different approach. Write a measure, if you don't have one, which calculates the amount due at an invoice level, and includes all your logic about currency conversion. The basic concept would be SUMX('Invoice Table', 'Invoice Table'[Amount]).
Rather than trying to calculate the number of days overdue for each invoice, work out the start and end date of your 31-60 day window, and then use DATESBETWEEN. The basic concept would be
Overdue 31-60 days =
var endDate = SELECTEDVALUE('Date slicer'[Date])
var startDate = endDate - 30
RETURN CALCULATE( [Invoice Amount], DATESBETWEEN('Date'[Date], startDate, endDate ) )
Thank you so much! You inspired me, actually I can filter fact_invoice table using [Due Date] column.
Here is the updated measure and it seems to work well.