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
zenton
Helper II
Helper II

Calculation using multiple filtered values from same column

Hi

I am trying to calculte energy usage using filtered values from the same column.

this is the calcultion I am trying to resolve. 

I get the error below.

A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

 

Bondi Use = CALCULATE(
SUM(Energy[Value]),Filter(Energy,Energy[Meter]="CB0NCGN01N (MWh)")+
SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00017 (MWh)")+
SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00018-EXP (MWh)") -
SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00018-IMP (MWh)")
)

1 ACCEPTED SOLUTION
zenton
Helper II
Helper II

Hi,

I managed to get the correct result using variables. I am not sure if this is the most efficient way to do this.

 

Bondi Use =
VAR A = CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="CB0NCGN01N (MWh)"))
VAR B = CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00017 (MWh)"))
VAR C = CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00018-EXP (MWh)"))
VAR D = CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00018-IMP (MWh)"))
Return
CALCULATE(A+B+C-D)

View solution in original post

5 REPLIES 5
zenton
Helper II
Helper II

Hi,

I managed to get the correct result using variables. I am not sure if this is the most efficient way to do this.

 

Bondi Use =
VAR A = CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="CB0NCGN01N (MWh)"))
VAR B = CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00017 (MWh)"))
VAR C = CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00018-EXP (MWh)"))
VAR D = CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00018-IMP (MWh)"))
Return
CALCULATE(A+B+C-D)

Hi,

 

Try this measure

 

=CALCULATE(SUM(Energy[Value]),Filter(Energy,Energy[Meter]="NCCCX00018-IMP (MWh)"||Energy[Meter]="NCCCX00018-EXP (MWh)"||Energy[Meter]="NCCCX00017 (MWh)"||Energy[Meter]="CB0NCGN01N (MWh)"))

 

Hope this helps.

 

 


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

Hi Thanks for you help but the solutions only allow you to perform one function like SUM() or COUNT() for all of the filter results. I need to do something different with each filtered value like sum, divide, subtract, multiply. A + B + C x D

Hi @zenton,

 

If so, I'm afraid your solution could be the only choice. Maybe the plus parts (+) could be optimized. You can sum them together.

 

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @zenton,

 

Try these two formulas below please. You can use either of them according to your requirement.

Bondi Use =
CALCULATE (
    SUM ( Energy[Value] ),
    Energy[Meter]
        IN {
            "CB0NCGN01N (MWh)",
            "NCCCX00017 (MWh)",
            "NCCCX00018-EXP (MWh)",
            "NCCCX00018-IMP (MWh)" }
)

 

 

Bondi Use =
CALCULATE (
    SUM ( Energy[Value] ),
    FILTER (
        Energy,
        Energy[Meter]
            IN {
                "CB0NCGN01N (MWh)",
                "NCCCX00017 (MWh)",
                "NCCCX00018-EXP (MWh)",
                "NCCCX00018-IMP (MWh)" }
    )
)

Best Regards,

Dale

 

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.