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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
bzjens
Frequent Visitor

Dynamic Receivables aging

Hi,

 

I have spent a few days trying to find a solution here, and I cannot find a post in here that sets me in the right direction.

 

I have a list of invoices from our accounting system with the following columns and a date slicer:

(Invoice table and date table not related)

bzjens_2-1635255939335.png

 

The above image looks correct, and I have been using this formula for the "amountRemaining" measure:

 

 

amountRemaining = IF(MIN(Invoices[dueDate]) < MIN('Calendar'[Date]) &&
    MAX('Calendar'[Date]) > MIN(Invoices[datePaid]), 
    SUM(Invoices[invoiceAmount]) - SUM(Invoices[amountPaid]), SUM(Invoices[invoiceAmount]))

 

 

 

All good until I choose a date after one of the datePaid dates:

bzjens_3-1635255972635.png

 

amountRemaining looks OK for the client that has made the payment (Client B), but the total is now wrong

It shows 300 000 - but it should be 530 000.

I need this total for a bar chart with date as x-axis.

 

Anyone knows how to fix this?

 

Thanks,

Børre

3 REPLIES 3
TheoC
Super User
Super User

Hi @bzjens 

 

Can you recreate the measure in the form of a Calculated Column then add that to the table?  This may lead to a quicker resolution. 

 

Otherwise, you will likely need to create a secondary measure using the "IF ( HASONEFILTER (Measure) = TRUE() , Measure1 , Measure2)" philosophy as explained by Greg in this post: https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

Hope the above is of some type of help 🙂

 

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

bzjens
Frequent Visitor

Hi @TheoC 

 

Thanks for replying!

I think I will have trouble using calculated columns as I'm aggregating over rows based on dates in the slicer

(To have my chart showing i.e. month by month)

 

But Greg's post is likely the way to go.

Thanks for sending me in that direction!

 

Børre

@bzjens absolutely mate. No trouble at all.

 

If it's not exactly what you were after, you may be able to achieve the outcome you're wanting by adjusting your SUMs to SUMXs. For example:

 

amountRemaining = IF(MIN(Invoices[dueDate]) < MIN('Calendar'[Date]) &&
    MAX('Calendar'[Date]) > MIN(Invoices[datePaid]), 
    SUMX('Invoices' , Invoices[invoiceAmount]) - SUMX('Invoices' , Invoices[amountPaid]), SUMX('Invoices',Invoices[invoiceAmount]))

 

Let me know either way!

 

Theo 🙂

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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