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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Complicated Sum formula of Object to NOT include

I am doing projections for contractual services and have the long following code; however my other column is not correct. I want to filter by all objects that are NOT the ones listed above. So basically how can i create a VAR other calculations that is not electricity, natural gas, etc.? There are many objects in this table so it just is not coded as Other. Contractual = VAR ELECTRICITY = CALCULATE ( SUM ( 'GL298A'[BUDGET-DTL] ), 'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object] = "Electricity" ) VAR NATURALGAS = CALCULATE ( SUM ( 'GL298A'[BUDGET-DTL] ), 'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object] = "NATURAL GAS" ) VAR WATER = CALCULATE ( SUM ( 'GL298A'[BUDGET-DTL] ), 'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object] = "WATER" ) VAR SEWER = CALCULATE ( SUM ( 'GL298A'[BUDGET-DTL] ), 'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object] = "SEWER SERVICE" ) VAR STORM = CALCULATE ( SUM ( 'GL298A'[BUDGET-DTL] ), 'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object] = "STORM WATER" ) VAR INSURANCEVEHICLES = CALCULATE ( SUM ( 'GL298A'[BUDGET-DTL] ), 'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object] = "INSURANCE VEHICLES" ) VAR PROPERTYINSURANCE = CALCULATE ( SUM ( 'GL298A'[BUDGET-DTL] ), 'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object] = "INSURANCE PROPERTY" ) VAR OTHER = CALCULATE ( SUM ( 'GL298A'[BUDGET-DTL] ), 'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object Category] = "Contractual", 'Accounts'[Object] = "Special Assessments" ) VAR ELECTRICITY2023 = -1.06 * ELECTRICITY VAR NATURALGAS2023 = -1.06 * NATURALGAS VAR WATER2023 = -1.15 * WATER VAR SEWER2023 = -1.04 * SEWER VAR STORM2023 = -1.15 * STORM VAR INSURANCEVEHICLES2023 = -1.07 * INSURANCEVEHICLES VAR PROPERTYINSURANCE2023 = -1.05 * PROPERTYINSURANCE VAR OTHER2023 = -1.00 * OTHER RETURN ELECTRICITY2023 + NATURALGAS2023 + WATER2023 + SEWER2023 + STORM2023 + INSURANCEVEHICLES2023 + PROPERTYINSURANCE2023 + OTHER2023
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You'd have to put all the other object values into a NOT ... IN construct, so in the OTHER variable replace the Accounts[Object] line with

NOT ( 'Accounts'[Object] IN { "INSURANCE PROPERTY", "STORM WATER" .... } )

View solution in original post

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

Has @johnt75 's solution solved your problem?

Best Regards,
Community Support Team _ kalyj

johnt75
Super User
Super User

You'd have to put all the other object values into a NOT ... IN construct, so in the OTHER variable replace the Accounts[Object] line with

NOT ( 'Accounts'[Object] IN { "INSURANCE PROPERTY", "STORM WATER" .... } )
Anonymous
Not applicable

Contractual = 
VAR ELECTRICITY =
    CALCULATE (
        SUM ( 'GL298A'[BUDGET-DTL] ),
        'GL298A'[FISCAL-YEAR] = 2022,
        'Accounts'[Object] = "Electricity"
    )
VAR NATURALGAS =
    CALCULATE (
        SUM ( 'GL298A'[BUDGET-DTL] ),
        'GL298A'[FISCAL-YEAR] = 2022,
        'Accounts'[Object] = "NATURAL GAS"
    )
VAR WATER =
    CALCULATE (
        SUM ( 'GL298A'[BUDGET-DTL] ),
        'GL298A'[FISCAL-YEAR] = 2022,
        'Accounts'[Object] = "WATER"
    )
VAR SEWER =
    CALCULATE (
        SUM ( 'GL298A'[BUDGET-DTL] ),
        'GL298A'[FISCAL-YEAR] = 2022,
        'Accounts'[Object] = "SEWER SERVICE"
    )
VAR STORM =
    CALCULATE (
        SUM ( 'GL298A'[BUDGET-DTL] ),
        'GL298A'[FISCAL-YEAR] = 2022,
        'Accounts'[Object] = "STORM WATER"
    )                                                                                                                                                                                                         VAR INSURANCEVEHICLES =                                                                                                                                                                                            CALCULATE (
        SUM ( 'GL298A'[BUDGET-DTL] ),
        'GL298A'[FISCAL-YEAR] = 2022,
        'Accounts'[Object] = "INSURANCE VEHICLES"
    )
VAR PROPERTYINSURANCE =
    CALCULATE (
        SUM ( 'GL298A'[BUDGET-DTL] ),
        'GL298A'[FISCAL-YEAR] = 2022,
        'Accounts'[Object] = "INSURANCE PROPERTY"
    )
VAR OTHER =
    CALCULATE (
        SUM ( 'GL298A'[BUDGET-DTL] ),
        'GL298A'[FISCAL-YEAR] = 2022, 'Accounts'[Object Category] = "Contractual",
        'Accounts'[Object] = "Special Assessments"
    )
VAR ELECTRICITY2023     = -1.06 * ELECTRICITY
VAR NATURALGAS2023   = -1.06 * NATURALGAS
VAR WATER2023   = -1.15 * WATER 
VAR SEWER2023 = -1.04 * SEWER 
VAR STORM2023     = -1.15 * STORM
VAR INSURANCEVEHICLES2023   = -1.07 * INSURANCEVEHICLES
VAR PROPERTYINSURANCE2023   = -1.05 * PROPERTYINSURANCE 
VAR OTHER2023 = -1.00 * OTHER 
RETURN
	ELECTRICITY2023 + NATURALGAS2023 + WATER2023 + SEWER2023 + STORM2023 + INSURANCEVEHICLES2023 + PROPERTYINSURANCE2023 + OTHER2023

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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