Forum Discussion

lcasey's avatar
lcasey
Post Prodigy
9 years ago

Create new Table calculating Balances

Hello,

 

Does anyone know how to create a table in Power BI by calculating the balance of customers?

 

I have a customer table, it contains Invoices and payments.   If you Subtract the payments from the invoice that is the current balance.

 

So what formula woud I Use to create a new table with only customers that have a balance?

 

In the table below I have several Customers, only 1 has a balance. I want to create a table that ONLY has that 1 customer with a balance.

 

 

CUSTNMBRDOCNUMBRDOCDATE CURNCYIDCCURNCYIDPPTRXDSCRNOriginal Amt USDAmount
ZWARTWOUDSLS0032694/4/2007 0:00 EUR Net 30SETT NL$10,021$10,021
ZWARTWOUD220549/7/2007 0:00 EUR Net 30SETT-NL 7,500$0($10,021)
ZYDOWICZSLS0081233/31/2009 0:00SLS008123USDUSDNet 30SETT-POLAND 1,500$500$500
ZYDOWICZ3213411/17/2009 0:00 USDUSDNet 30SETT-POLAND 1,500$0($500)
NEST INC522327/1/2013 0:00 JPYJPYNet 30ENF EXP JPY 475,744$0($4,800)
NEST INCSLS0180777/1/2013 0:00 JPYJPYNet 30SETT JPY 2,547,109$25,700$25,700
NEST INC524298/6/2013 0:00 USDJPYNet 30PMT JPY 2,071,365$0($20,900)
TESTSLS9999910/1/2013 0:00 USDJPYNet 30PMT JPY 2,071,365$0$5,000

 

 

 

 

 

 

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    You should just have to filter your table visualization by Amount greater than 0

  • v-haibl-msft's avatar
    v-haibl-msft
    Microsoft Employee

    lcasey

     

    I’m not sure which columns in your provided table are Invoices and Payments, so I just test with following table. You can create a measure for Balance first and then use CALCULATETABLE Function to create a table only includes customers with balance.

     

     

    Balance =
    CALCULATE ( SUM ( Table1[Invoices] ), ALLEXCEPT ( Table1, Table1[Customer] ) )
    - CALCULATE ( SUM ( Table1[Payments] ), ALLEXCEPT ( Table1, Table1[Customer] ) )
    HasBalance = 
    CALCULATETABLE ( Table1, FILTER ( Table1, [Balance] > 0 ) )

     

     

    Best Regards,

    Herbert