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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculate Total Amount using Filter

I have a table that looks like this

 

And I want a measure that will calculate two things by Customer Name, so that I can put it in a matrix table.

 

1. Total Expected Amount: This will calculate the Total Expected Amount by each Customer Name using the data in the Expected Amount column e.g. Customer A should have total Expected Amount = 28,200

 

2. Total Amount Paid: This will calculate the Total Amount Paid by each Customer Name using the data in Amount Paid column by applying the filter below:

state= Paid & Status =  Paid by Customer or Paid by Agency or Paid by BU

OR

Expected Amount = Amount Paid

e.g. Customer F total Amount Paid should be = 138,015

CustomerApplication TitleInvoice TitleExpected AmountAmount PaidStateStatus
AAPP-0000001INV-EN-0000001                    1,000.00         1,500.00PaidPaid by Customer
AAPP-0000001INV-EN-0000002                    5,000.00         5,000.00PaidRefunded
AAPP-0000001INV-EN-0000003                       300.00   
AAPP-0000002INV-EN-0000004                       400.00             400.00PaidPaid by Agency
AAPP-0000003INV-EN-0000005                    4,000.00         4,500.00ActiveUnderPayment
AAPP-0000004INV-EN-0000006                    8,000.00       80,000.00ActiveOverpayment
AAPP-0000005INV-EN-0000007                       500.00             500.00PaidPaid by Customer
AAPP-0000006INV-EN-0000008                    9,000.00         9,000.00PaidPaid by Agency
BAPP-0000007INV-EN-0000009    
CAPP-0000008INV-EN-0000010                       200.00             200.00PaidPaid by Customer
CAPP-0000009INV-EN-0000011                    4,000.00         4,000.00PaidPaid by Agency
CAPP-0000010INV-EN-0000012                    3,500.00         3,500.00PaidPaid by Customer
DAPP-0000011INV-EN-0000013                    1,000.00             800.00ActiveUnderPayment
EAPP-0000012INV-EN-0000014                 23,000.00       23,000.00PaidPaid by Customer
FAPP-0000013INV-EN-0000015                 24,500.00       20,000.00ActiveUnderPayment
FAPP-0000014INV-EN-0000016                 23,000.00       23,000.00PaidPaid by Customer
FAPP-0000014INV-EN-0000017                 23,001.00       23,001.00PaidPaid by Agency
FAPP-0000014INV-EN-0000018                 23,002.00       23,002.00PaidPaid by Customer
FAPP-0000015INV-EN-0000019                 23,003.00       23,003.00PaidPaid by Agency
FAPP-0000016INV-EN-0000020                 23,004.00       23,004.00PaidPaid By BU
FAPP-0000017INV-EN-0000021                 23,005.00       23,005.00PaidPaid by Agency
GAPP-0000018INV-EN-0000022    

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,
Thanks for @Ashish_Mathur  rply.
Here are my measures

Total Expected Amount = 
CALCULATE(
    SUM('Table'[Expected Amount]),
    ALLEXCEPT(
        'Table',
        'Table'[Customer]
    )
)
Total Amount Paid = 
CALCULATE(
    SUM('Table'[Amount Paid]),
    FILTER(
        ALLEXCEPT(
            'Table',
            'Table'[Customer]
        ),
        'Table'[State] = "Paid" && 'Table'[Status] = "Paid by Customer" || 
        'Table'[State] = "Paid" && 'Table'[Status] = "Paid by Agency" ||
        'Table'[State] = "Paid" && 'Table'[Status] = "Paid by BU"
    )
)

Final output

vheqmsft_0-1718000204300.png

Best regards,
Albert He

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,
Thanks for @Ashish_Mathur  rply.
Here are my measures

Total Expected Amount = 
CALCULATE(
    SUM('Table'[Expected Amount]),
    ALLEXCEPT(
        'Table',
        'Table'[Customer]
    )
)
Total Amount Paid = 
CALCULATE(
    SUM('Table'[Amount Paid]),
    FILTER(
        ALLEXCEPT(
            'Table',
            'Table'[Customer]
        ),
        'Table'[State] = "Paid" && 'Table'[Status] = "Paid by Customer" || 
        'Table'[State] = "Paid" && 'Table'[Status] = "Paid by Agency" ||
        'Table'[State] = "Paid" && 'Table'[Status] = "Paid by BU"
    )
)

Final output

vheqmsft_0-1718000204300.png

Best regards,
Albert He

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

Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Total expected amount = sum(Data[Expected amount])

Total amount paid = calculate(sum(Data[amount paid]),Data[State]="Paid"&&Data[Status]<>"Refunded")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Given the one to many relationship between a property and invoices, how would this work?

You confuse me to the hilt.  In the original question, there is no mention of more than 1 table so the question os building a relationship does not arise at all.  Furthermore, have you even tried my solution?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.