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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
digicontrolling
Frequent Visitor

DAX Formula to Analyze Invoice Payment Status at Specific Dates

Problem Statement: I am working with invoice data and want to categorize invoices based on their payment status as of specific dates. I would like to select a specific date from a Date dimension table and see how the situation looked at that particular moment. Additionally, I want to display how the payment status categories evolved over time.

Requirements:

  1. Categorize invoices based on the age of the unpaid amount as of a specific date.
  2. Select a specific date from a Date dimension table to analyze the payment status as of that date.
  3. Display the evolution of the payment status categories over time.

Sample Data Structure: Here's a simplified example of the data:


InvoiceNumber  InvoiceDate   PaymentDate   InvoiceAmount   PaymentAmount   
101.01.2315.03.2310050
215.02.2310.04.23200200
315.03.23(null)1500

Objective: I want to create a measure that takes into consideration the selected date from the Date dimension table and categorizes the invoices accordingly. For example, if the selected date is 31.03.23, the measure should consider only the payments made up to that date and ignore the future payments.

Categories:

  • "0-30 Days Due": If the unpaid amount is due for 0-30 days as of the selected date.
  • "31-60 Days Due": If the unpaid amount is due for 31-60 days as of the selected date.
  • "Over 60 Days Due": If the unpaid amount is due for over 60 days as of the selected date.
  • "Paid": If the invoice is paid as of the selected date.

I appreciate any insights or guidance on how to achieve this using DAX in Power BI. Feel free to provide a simplified solution if necessary.

1 ACCEPTED SOLUTION
Mahesh0016
Super User
Super User

@digicontrolling I hope this helps you. Thank You.

Max Date = MAX(Slicer Date) / Min Date = MIN(Slicer Date)
E.g 
0-30 = calculate(
                [Total Sales],
                Filter(
                         ALL( Payments[Date] ),
                         Datediff ( Payments[Date]<[Max Date]/[Min Date] ) >=0
                         &&

                         Datediff ( Payments[Date]<[Max Date]/[Min Date] ) <31
                        )
)

View solution in original post

1 REPLY 1
Mahesh0016
Super User
Super User

@digicontrolling I hope this helps you. Thank You.

Max Date = MAX(Slicer Date) / Min Date = MIN(Slicer Date)
E.g 
0-30 = calculate(
                [Total Sales],
                Filter(
                         ALL( Payments[Date] ),
                         Datediff ( Payments[Date]<[Max Date]/[Min Date] ) >=0
                         &&

                         Datediff ( Payments[Date]<[Max Date]/[Min Date] ) <31
                        )
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.