Performance issue

@lomorris You don’t need to inject filters manually when you have already done that throught the filters pane, and a filter over Customers[Customer Number] already exists in the filter context so no need to add it inside CALCULATE.

You should write your code in this way:

Total Ledger Amount = 
SUM ( 'Service Ledger Entries'[Amount] )

.

Customer Labor Amount 2 = 
CALCULATE (
    [Total Ledger Amount] * -1,
    KEEPFILTERS ( 'Service Ledger Entries'[Resource Type] = "Resource" )
) 

.

Customer Misc Amount 2 = 
CALCULATE (
    [Total Ledger Amount] * -1,
    KEEPFILTERS ( 'Service Ledger Entries'[Resource Type] = "Service Cost" )
)

.

Customer Parts Amount 2 = 
CALCULATE (
    [Total Ledger Amount] * -1,
    KEEPFILTERS ( 'Service Ledger Entries'[Resource Type] = "Item" )
)
3 Likes