cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Dynamic AR Aging Not working on Customer Level

Hello,

I am trying to build a series of measures for a report that will dynamically calculate the AR aging by buckets (current, <15 days overdue, 16-30 days overdue, 31-90 days overdue, 90+ overdue) based on a slicer. I have the following set up:

1) Date reference table

2) Transaction table with the following key fields: Transaction Date (of sale), Due Date, and Closed Date. If something is not yet paid, and thus active AR, the closed date has a future date. That is the way the system is set up.

3) Measure #1

Invoice Aging =
VAR CurrentDate = calculate(max('Reference Dates'[Date]),
USERELATIONSHIP('Reference Dates'[Date],'Sales and Collections'[CLOSED]))
VAR AgingDifference = calculate(datediff(max('Sales and Collections'[DUEDATE]),CurrentDate,DAY),
ALL('Reference Dates'[Date]),
'Sales and Collections'[CLOSED]>CurrentDate,
'Sales and Collections'[TRANSDATE]<=CurrentDate)
VAR AgingBucket = if(isblank(AgingDifference),blank(),
if(
AgingDifference<=0,"Current",
if(AgingDifference<=15,"<=15",
if(AgingDifference<=30,"16-30",
if(AgingDifference<=90,"31-90",
if(AgingDifference>90,">90",blank()))))))
RETURN
AgingBucket

This measure seems to be working on an invoice by invoice basis, but it doesn't work when summed up. See below for an exmaple when the slicer is set on October 16th:

However, when I try to do a summary table (I want to see the sum of all invoices by each bucket, for example \$60k are current, \$8k are <15, etc.) but it all buckets it into current. Can someone help fix this measure?

3 REPLIES 3
Community Support

According to your statement, I know [Invoice Aging] should be a measure. Measure will only show aggregate value as your screenshot. So this measure will work by invoice basis and will only show one bucket "Current" when you remove invoice column.

Currently you want to show the sum of all invoices by each bucket, I suggest you to add an unrelated bucket table with all aging bucket into your data model.

Then try this measure.

``````New_Sales =
VAR _SUMMARIZRE =
SUMMARIZE (
'Sales and Collections',
'Sales and Collections'[INVOICE],
'Sales and Collections'[Sales],
"Invoice Aging",
VAR CurrentDate =
CALCULATE (
MAX ( 'Reference Dates'[Date] ),
USERELATIONSHIP ( 'Reference Dates'[Date], 'Sales and Collections'[CLOSED] )
)
VAR AgingDifference =
CALCULATE (
DATEDIFF ( MAX ( 'Sales and Collections'[DUEDATE] ), CurrentDate, DAY ),
ALL ( 'Reference Dates'[Date] ),
'Sales and Collections'[CLOSED] > CurrentDate,
'Sales and Collections'[TRANSDATE] <= CurrentDate
)
VAR AgingBucket =
IF (
ISBLANK ( AgingDifference ),
BLANK (),
IF (
AgingDifference <= 0,
"Current",
IF (
AgingDifference <= 15,
"<=15",
IF (
AgingDifference <= 30,
"16-30",
IF (
AgingDifference <= 90,
"31-90",
IF ( AgingDifference > 90, ">90", BLANK () )
)
)
)
)
)
RETURN
AgingBucket
)
RETURN
SUMX (
FILTER ( _SUMMARIZRE, [Invoice Aging] = MAX ( 'Invoice Aging'[Invoice Aging] ) ),
[Sales]
)``````

Best Regards,
Rico Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Frequent Visitor

Hey @v-rzhou-msft . Thanks for the proposed solution. I shifted this Invoice Aging metric to a table named Invoice Aging. The table looks like this:

When I pasted your formula into a new measure in this table, i get the following errors:

1)

2)

How can i fix these errors?

For reference, here is the sales measure that is causing the issue, which sums up the amount for every transaction type but 15 (which is payments)

Frequent Visitor

@v-rzhou-msft Do you have an update on my question?

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors