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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
Community Champion
Community Champion

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

TheoC
Community Champion
Community Champion

@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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors