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
Telli
Frequent Visitor

Calculating a weighted average if date within range

Hi, 

My Employer has asked me to calculate e "weighted average days" from invoices.

 

I assume that I would need to build a formula on the following logic 

Sumproduct(Amount * Days(outstanding)/Total Amount

Where the variables would be constrained to:
given date is >issue date and <PayDate unless Paydate is Blank

 

Invoice NOAmountIssue DatePayDate
1100001.01.2215.01.22
290003.01.22null
370010.01.2221.01.22
4110015.01.22null

 

14.01.22 -> 1000x13/2600 + 900x11/2600 + 700*4/2600 = 9,884 Days

15.01.22 -> 900x12/1600+700*5/1600 = 8,9375

 

I have tried write a bunch of formulas in DAX, but I come up short when I need to filter datex "between" Issue- and PayDate while also taking into account if Paydate is null.

 

with regards

telli

 

 

1 ACCEPTED SOLUTION

Hi, @Telli 

If your problem has been solved, you could accept the helpful answer as solution to close this thread.

Other community members will easily find the solution when they get the same issue.

If you haven't, please feel free to ask.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
Telli
Frequent Visitor

Much appriciated @amitchandak. Will try it during the weekend 

Hi, @Telli 

If your problem has been solved, you could accept the helpful answer as solution to close this thread.

Other community members will easily find the solution when they get the same issue.

If you haven't, please feel free to ask.

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@Telli , refer if this blog can help

 

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.