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

Summarizing Accounts Receivable Data to show Net Balance Value per Invoice ID

Hi everyone

First of all I'd like to mention, that I am rather new to PowerBI and I am reading a LOT (!) in this forum. The posts are very helpful and solved already numerous issues I faced. However, there is one problem I could not solve yet:

 

We are creating a accounts receivable dashboard for our sales employees, where they should see the open and due invoices of their customers. This is what it looks like (recreated example with sample data - due to confidentiality of the data):

JoZu_0-1657193896353.png

The Open Invoices Table shows all unpaid Invoices. The Due Invoices Table shows all open invoices with a due date which is in the past. 

 

The problem:

Our customers are allowed to make partial payments of an invoice. Those cases appear as negative numbers in the table and do not have a due date. This is a problem, as my sum for the due invoices is not correct.

 

My goal:

I wanted to create a measure which summarizes the "Balance in Transaction Currency" based on the "Customer Invoice ID".  This is what I wrote as a measure: 

Net Value per Invoice =

SUMX (

    SUMMARIZE (

        'Accounts Receivable', 'Accounts Receivable'[Customer Invoice ID],

        "Net Balance", SUM('Accounts Receivable'[Balance in Transaction Currency])

    ),

    [Net Balance]

)

Unfortunately this does not solve my issue. However, if I only use the Summarize function and create a new table with it, it works fine. But I want to avoid an additional Table in our dataset, as it is already pretty big and hard to see all the relationships.

 

Sample data: 

The table is called "Accounts Receivable" in our data model.

Business Partner ID (Account ID)

Customer Invoice IDDue DateDue Date Calendar DateTransaction CurrencyBalance in Transaction Currency
1001111101.65698E+1207.07.2022EUR100
1001111201.65698E+1207.07.2022EUR250
1001111301.65698E+1207.07.2022EUR500
100111130  EUR-100
1001122401.65698E+1207.07.2022EUR100
1001122501.65698E+1207.07.2022EUR500
1001133601.65698E+1207.07.2022EUR1000
100113360  EUR-500
1001133701.65698E+1207.07.2022EUR300
100113370  EUR-50
1001133801.65698E+1207.07.2022EUR200

Note: Due Date is in epoch format, Due Date Calendar Date is formatted as a "normal" date.

 

The entirely open Invoices are not causing any issues. The one I am interested in are the ones with partial payments (you can identify them by Customer Invoice ID appearing multiple times and a missing due date). The expected results for the due invoices tables are (cases with partial payments are marked red): 

Business Partner ID (Account ID)Customer Invoice IDDue DateDue Date Calendar DateTransaction CurrencyBalance in Transaction Currency
1001111101.65698E+1207.07.2022EUR100
1001111201.65698E+1207.07.2022EUR250
1001111301.65698E+1207.07.2022EUR400
1001122401.65698E+1207.07.2022EUR100
1001122501.65698E+1207.07.2022EUR500
1001133601.65698E+1207.07.2022EUR500
1001133701.65698E+1207.07.2022EUR250

 

I'd be very grateful if someone of this great community could help me solve this issue. Many thanks already in advance!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

HI @JoZu 
Here is a sample file with the solution https://we.tl/t-BJ0BtLRpwW

Due Transation Currency = 
SUMX ( 
    SUMMARIZE ( 'Accounts Receivable', 'Accounts Receivable'[Customer Invoice ID],'Accounts Receivable'[Due Date Calendar Date] ),
    CALCULATE (
        VAR CurrentDueDate = SELECTEDVALUE ( 'Accounts Receivable'[Due Date Calendar Date] )
        RETURN 
            IF (
                CurrentDueDate <= TODAY ( ) && CurrentDueDate <> BLANK ( ),
                CALCULATE ( 
                    SUM ( 'Accounts Receivable'[Balance in Transaction Currency] ), 
                    ALLEXCEPT ( 'Accounts Receivable', 'Accounts Receivable'[Customer Invoice ID] ) 
                )
            )
    )
)

1.png

View solution in original post

2 REPLIES 2
JoZu
Frequent Visitor

Thank you very much @tamerj1 ! The measure works perfectly fine and does what its supposed to! I forgot to mention, that the date restriction was done with a filter on the visual. You even included this into the measure - even better.

I am more than happy with this solution and the very fast reply - THANKS!

tamerj1
Super User
Super User

HI @JoZu 
Here is a sample file with the solution https://we.tl/t-BJ0BtLRpwW

Due Transation Currency = 
SUMX ( 
    SUMMARIZE ( 'Accounts Receivable', 'Accounts Receivable'[Customer Invoice ID],'Accounts Receivable'[Due Date Calendar Date] ),
    CALCULATE (
        VAR CurrentDueDate = SELECTEDVALUE ( 'Accounts Receivable'[Due Date Calendar Date] )
        RETURN 
            IF (
                CurrentDueDate <= TODAY ( ) && CurrentDueDate <> BLANK ( ),
                CALCULATE ( 
                    SUM ( 'Accounts Receivable'[Balance in Transaction Currency] ), 
                    ALLEXCEPT ( 'Accounts Receivable', 'Accounts Receivable'[Customer Invoice ID] ) 
                )
            )
    )
)

1.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.