Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Trying to calculate only the selected month outstanding invoices from an Invoice & Receipts table and the measure is not working as expected.
Selected date can be any date in previous months. If the selection is for the end of month of SEP 2023,
1. Current Month total need to consider all the invoices for SEP and receipts for the invoices for SEP only. Receipts for prior month invoices should not be considered.
Current Month = CALCULATE (
SUM ( InvTable[Value] ) + SUM ( RcptTable[Value] ),
FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
)
Balance for Customer should consider all invoices and receipts until the selected date
InvTable has all invoices and RcptTable contains receipts and any advance payments
Invoice Table
Customer | Invoice | Invoice Date | Value |
CUS1 | INV-L1 | 8/20/2023 | 100 |
CUS1 | INV-L2 | 8/20/2023 | 150 |
CUS1 | INV-1 | 9/1/2023 | 500 |
CUS1 | INV-2 | 9/15/2023 | 1000 |
CUS1 | INV-3 | 9/25/2023 | 2000 |
CUS5 | INV-6 | 10/4/2023 | 1100 |
Receipts of all invoices and any advance payment
Customer | Invoice | Rcpt Date | Value |
CUS1 | INV-L1 | 9/5/2023 | -100 |
CUS1 | INV-1 | 9/1/2023 | -200 |
CUS1 | INV-1 | 9/29/2023 | -200 |
CUS1 | INV-2 | 9/30/2023 | -1000 |
CUS1 | INV-1 | 10/2/2023 | -50 |
CUS2 | ADV-1 | 9/20/2023 | -250 |
Expected result for selected date of 09/30/2023 ( End of Month)
Customer | Balance | Current Month |
CUS1 | 2250 | 2000 |
CUS2 | -250 |
PBIX attached. Please advice. https://drive.google.com/file/d/1CRXVBsOICBmQHhcg5q9WXRbeA3roKXiK/view?usp=sharing
Sorry. That is not adding up for Current month total. That is the issue that i posted.
For Sep , there are 3 invoices that adds up to 3500 (500 + 1000 + 2000) and receipts for SEP invoices adds up to 1400 (200 + 200 + 1000 ) . Current month total should show as 2100 and not 2250.
Nowhere in your original post have you shared that the answer should be 2,100. Anyways, the answer should not even be that - it should be 2,000 i.e. 3,500 - 1,500. The revised measure for this will be:
Sorry @Ashish_Mathur . I think i didn't make it clear in my earlier post.
Current Balance is actually the invoices that is balance for the month selected. So if there is a receipt for an invoice from previous month that should NOT be in the current month balance.
In the example i shared, only INV-1 & INV-2 are the invoices paid to be accounted for receipts. That's why receipts is 1400.
I just cannot understand your question. Someone who does will help you.