Invoice payment and running balance YoY

Hi @arve.haugland (v2)

Thank you for the feedback, and the help with the formula.

After some further testing, including your sample, the total Accounts Receivable AND the split into segments / AR Aging groups, works fine, for the Current period, Last month and for Last Year.

PBIX 3x attached:
Customer Receivables DEMO DS v2_2 ArveHaugland.pbix (407.5 KB)

Cust Receiv DEMO DS audit Oct sample v2.pbix (359.4 KB)

Customer Receivables DEMO DS v3.pbix (1.2 MB)

Easily to check in the page “Aging over periods” in each of the PBIX files.

  • Just to be able to verify the calculated amounts per AR aging segment /bucket, as presented in the report, calculated columns are added for Receivables and Aging for Oct, Nov and Dec 2021 in the table ‘ARFBL5N’ in "Cust Receiv DEMO DS audit Oct sample v2.pbix "

All measures are based upon the same filter selection, see four of the six measures used below, :grinning:

Current Days Due = 
Var ReportingDate = MAX(Dates[Date]) --period max date (Dec2021 = 31.12.2021) (NON !! connected date table)
Var NetDueDate = MIN('ARFBL5N'[Net due date] )
Var DocumentDate = MIN( 'ARFBL5N'[Document Date])
Var ClearingDate = Max('ARFBL5N'[Clearing date])
Var DaysDue3 =  if(and( DocumentDate <= ReportingDate, --filter upon all invoices before reporting date,
                     or(ISBLANK( ClearingDate), ClearingDate > ReportingDate)), --either without settlement date or settled after reporting date 
                           DATEDIFF( NetDueDate, Reportingdate, DAY), blank())
return DaysDue3
Current Receivables Per Group = 
VAR FilteredARLedger   =   FILTER ( 'ARFBL5N',
                                and( 'ARFBL5N'[Document Date] <= max(Dates[Date]), --filter upon all invoices before reporting date
                                    or(ISBLANK( 'ARFBL5N'[Clearing date]), 'ARFBL5N'[Clearing date]>max(Dates[Date]))))  -- without clearing date  or clearing date > reporting date
Var AgingGroup =  CALCULATE( SUM( 'ARFBL5N'[Amount in local currency] ),
                      FILTER( FilteredARLedger,  --to speed up the calculation, as the data is filtered
                        COUNTROWS(
                            FILTER( 'Aged2 Debtor Groups',
                                [Current Days Due] >= 'Aged2 Debtor Groups'[Min2] &&
                                [Current Days Due] <= 'Aged2 Debtor Groups'[Max2] ) ) > 0 ) )
 return AgingGroup
 --if(max(Dates[Date]) > TODAY(), BLANK(),  AgingGroup) not to present future periods
Last Month Days Due = 
Var ReportingDate = eomonth(max(Dates[Date]),-1)  -- last month max date (Dec2021 = 30.11.2021) (NON !! connected date table)
Var NetDueDate = MIN('ARFBL5N'[Net due date] )
Var DocumentDate = MIN( 'ARFBL5N'[Document Date])
Var ClearingDate = Max('ARFBL5N'[Clearing date])
Var DaysDue3 =  if(and( DocumentDate <= ReportingDate, --filter upon all invoices before reporting date,
                     or(ISBLANK( ClearingDate), ClearingDate > ReportingDate)), --either without settlement date or settled after reporting date 
                           DATEDIFF( NetDueDate, Reportingdate, DAY), blank())
return DaysDue3
Last Month Receivables Per Group = 
VAR FilteredARLedger   =   FILTER ( 'ARFBL5N',
                                and( 'ARFBL5N'[Document Date] <= EOMONTH(MAX(Dates[Date]),-1), --filter all document lines before Last Month reporting period 
                                    or(ISBLANK( 'ARFBL5N'[Clearing date]), 'ARFBL5N'[Clearing date] > EOMONTH(MAX(Dates[Date]),-1))))  -- without clearing date  or clearing date > Last month reporting date

Var AgingGroup =  CALCULATE( SUM( 'ARFBL5N'[Amount in local currency] ),
                      FILTER( FilteredARLedger, --to speed up the calculation, as the data is filtered
                        COUNTROWS(
                            FILTER( 'Aged2 Debtor Groups',
                                [Last Month Days Due] >= 'Aged2 Debtor Groups'[Min2] &&
                                [Last Month Days Due] <= 'Aged2 Debtor Groups'[Max2] ) ) > 0 ) )
 return AgingGroup

Kind regards, Jan van der Wind