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
pt008
New Member

Dynamic DateDiff - Aging of DaysToPay

Hello,

 

I have a fact table with Sales Invoices 

Each transaction has the following fields:

DateOfTrans,

Amount,

Balance: live field - updated as and when payments are applied to it (=0 for payments),

DueDate, and 

Last_paid_Date: Refers to the date of the last payment trans applied to a sales invoice =>If Balance = 0 this is the date the sales invoice was completely paid off

 

I am looking to calculate a snapshot view  of average days a customer takes to pay off invoices (and then show aging of said DaystoPay over time) with the following logic:

1. If Balance = 0:

           (a) Last_paid_Date < SelectedDate => DaystoPay =  (Last_paid_Date - DateOfTrans)

           (b) Last_paid_Date < SelectedDate => DaystoPay =  (SelectedDate - DateOfTrans)  (i.e. consider it unpaid as of selected date)

2. If Balance <> 0 => DaystoPay =  (SelectedDate - DateOfTrans)

 

I am having troubles calculating this at a row level because DAX will only let me select fields as an aggregate value.

 

Pelase help

 

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hi @pt008 

 

Please read this article if you want your question answered.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Best Regards,
Mariusz

Please feel free to connect with me.
Mariusz Repczynski

 

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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