Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
gra_197
Helper II
Helper II

Calculating the number of days outstanding

Hi,

 

I need some help on calculating the number of days a purchaser invoice remains outstanding.

Daily I receive an excel ss with a number of outstanding invoices.

This spreadsheet contains the name of the debtor, invoice number,  date invoice is to be paid, todays date and the number of days the invooce is outstanding. For every day the invoice remains outsranding, the number of days will increase.

What Im looking to do is address late payers and show them the length of time invoices remained outstanding.

Ive been able to create a table visual with the Name,invoice number,actual date of invoice and latest date outstanding. What I need in this visual is another column that shows the difference between the actual settlement date and the latest recorded date outstanding. Can someone confirm the best way to do this.?

1 ACCEPTED SOLUTION
cengizhanarslan
Super User
Super User

Assuming:

  • One row per invoice per day in the Excel file

  • You already have Invoice Date and Outstanding Date in the model

Measure:

Days Outstanding =
VAR InvoiceDate =
    MIN ( Invoices[InvoiceDate] )
VAR LastOutstandingDate =
    MAX ( Invoices[OutstandingDate] )
RETURN
DATEDIFF ( InvoiceDate, LastOutstandingDate, DAY )

Use this in a table visual with Debtor and Invoice Number.

If the invoice is still unpaid, Replace "LastOutstandingDate" with TODAY():

VAR EndDate =
    IF ( MAX ( Invoices[IsPaid] ) = TRUE(), MAX ( Invoices[OutstandingDate] ), TODAY() )

Then use "EndDate" in "DATEDIFF".

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

View solution in original post

3 REPLIES 3
krishnakanth240
Power Participant
Power Participant

Hi @gra_197 

 

Measure

Latest Outstanding Date =

MAX ( Invoices[Snapshot Date] 

)

 

Measure 

Effective End Date =

VAR SettlementDate =

    MAX ( Invoices[Settlement Date] )

VAR LatestOutstanding =

    MAX ( Invoices[Snapshot Date] )

RETURN

    COALESCE ( SettlementDate, LatestOutstan

ding )

 

Measure

Days Outstanding =

VAR InvoiceDate =

    MIN ( Invoices[Invoice Date] )

VAR EndDate =

    [Effective End Date]

RETURN

    DATEDIFF ( InvoiceDate, EndDate,

 DAY )

cengizhanarslan
Super User
Super User

Assuming:

  • One row per invoice per day in the Excel file

  • You already have Invoice Date and Outstanding Date in the model

Measure:

Days Outstanding =
VAR InvoiceDate =
    MIN ( Invoices[InvoiceDate] )
VAR LastOutstandingDate =
    MAX ( Invoices[OutstandingDate] )
RETURN
DATEDIFF ( InvoiceDate, LastOutstandingDate, DAY )

Use this in a table visual with Debtor and Invoice Number.

If the invoice is still unpaid, Replace "LastOutstandingDate" with TODAY():

VAR EndDate =
    IF ( MAX ( Invoices[IsPaid] ) = TRUE(), MAX ( Invoices[OutstandingDate] ), TODAY() )

Then use "EndDate" in "DATEDIFF".

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

@cengizhanarslan thanks so much, worked a treat.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.