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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Pbi07
Helper V
Helper V

Receivable Balance Measure

Hello -

Having trouble with arriving at the Receivable Balance calculation Measure. Goal is to provide the Balance of Customer as of a particular Historical date . 

I tried using the measure to calculate Invoice value - All Receipts, as of the sellected  date, but does not seem to be working. Not sure wht i am messing up. Please help. 

 

Invoice Table 

CustomerInvoiceInvoice DateValue
CUS1INV-L18/20/2023100
CUS1INV-L28/20/2023150
CUS1INV-19/1/2023500
CUS1INV-29/15/20231000
CUS1INV-39/25/20232000
CUS5INV-610/4/20231100

 

Receipts of all invoices and any advance payment 

CustomerInvoiceRcpt DateValue
CUS1INV-L19/5/2023-100
CUS1INV-19/1/2023-200
CUS1INV-19/29/2023-200
CUS1INV-29/30/2023-1000
CUS1INV-110/2/2023-50
CUS2ADV-19/20/2023-250

 

Created measure -  

Balance = CALCULATE(SUM(InvTable[Value]), FILTER(ALL(InvTable[Invoice Date]),InvTable[Invoice Date]<= MAX('Calendar'[Date]))) -
CALCULATE(SUM(RcptTable[Value]), FILTER(ALL(RcptTable[Rcpt Date]),RcptTable[Rcpt Date] <= MAX('Calendar'[Date])))
 
Current Month measure need to select the balnce for that month. ( all invoices happened in the month and less receipts in that month )
Expected results if selected date - 8/31/2023
CustomerBalanceCurrent Month 
CUS1250250

 

Expected results for selected date 9/30/2023 

 

CustomerBalanceCurrent Month 
CUS122502100
CUS2-250 

 

Pbix attached   https://drive.google.com/file/d/1k4aGruU1ObhUurwYHRocYP5QC0Tj2vfq/view?usp=sharing

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Pbi07 ,

 

You can simply your calculation but using the related calendar table instead of the facts table in your measure so for balance, that would be

CALCULATE (
        SUM ( InvTable[Value] ) + SUM ( RcptTable[Value] ),
        FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
    )

What I don't get is your current month number for CUS1. Per data, that should be 2000 and not 2100 (3500-1500).

danextian_0-1700472917050.png

Please see attached pbix for details.

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Hi @Pbi07 ,

 

You can simply your calculation but using the related calendar table instead of the facts table in your measure so for balance, that would be

CALCULATE (
        SUM ( InvTable[Value] ) + SUM ( RcptTable[Value] ),
        FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
    )

What I don't get is your current month number for CUS1. Per data, that should be 2000 and not 2100 (3500-1500).

danextian_0-1700472917050.png

Please see attached pbix for details.

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

 

Thanks @danextian .You are right. It is 2000. Good solution. 

123abc
Community Champion
Community Champion

It looks like you are trying to create a measure to calculate the receivable balance for a specific historical date. The measure you provided seems close, but it might need a few adjustments. Here's an updated version of your measure:

 

Receivable Balance =
CALCULATE(
SUM(Invoice[Value]),
FILTER(
ALL(Invoice),
Invoice[Invoice Date] <= MAX('Calendar'[Date])
)
) -
CALCULATE(
SUM(Receipts[Value]),
FILTER(
ALL(Receipts),
Receipts[Rcpt Date] <= MAX('Calendar'[Date])
)
)

 

Here, I've replaced InvTable and RcptTable with Invoice and Receipts to match the table names you provided. Also, I removed the unnecessary SUMX function and simplified the formula.

Make sure to replace Invoice and Receipts with the actual names of your tables.

Now, you can use this measure in your visualizations. If you want to get the receivable balance for a specific date, use the date as a filter context in your report or use it in a CALCULATE statement.

For the current month measure, you can use a similar approach:

 

Current Month Receivable Balance =
CALCULATE(
[Receivable Balance],
FILTER(
ALL('Calendar'),
'Calendar'[Date] >= STARTOFMONTH(MAX('Calendar'[Date])) &&
'Calendar'[Date] <= MAX('Calendar'[Date])
)
)

 

This measure calculates the receivable balance for the current month based on the selected date.

Now, when you select a specific date, you should get the expected results for the receivable balance and the current month receivable balance in your report.

 
 
 
 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Thanks @123abc for the help. 

I had trouble with receivable balance measure with the above approach. 

 

Pbi07_0-1700606505453.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.