cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
webportal
Impactful Individual
Impactful Individual

Measure to sum column with multiple filters

I want to sum the absolute value of column "Saldo" in table "Balancete Geral", whose column "Conta" is:

  • 11
  • 12
  • 13

In a single measure.

 

This can be achieved with Calculate, like:

Measure = 
CALCULATE (
    ABS ( SUM ( 'BalanceteGeral'[Saldo] ) );
    BalanceteGeral[Conta] = 11
)+
CALCULATE (
    ABS ( SUM ( 'BalanceteGeral'[Saldo] ) );
    BalanceteGeral[Conta] = 12
)+
CALCULATE (
    ABS ( SUM ( 'BalanceteGeral'[Saldo] ) );
    BalanceteGeral[Conta] = 13
)

But, isn't there a more efficient way to use the CALCULATE filter to consider 3 or more filters?

I could use OR in a single filter, but it only accepts two arguments...

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Also, an alternative to using the OR function that bsas suggested is to use || for the Or component. This will allow you to layer up multiple OR conditions, while the OR DAX Function only allows two variables to be compared.

View solution in original post

3 REPLIES 3
bsas
Post Patron
Post Patron

Hi @webportal,

 

You could try to use SUMX or you can use multiply OR - it looks like OR( value1, OR(value1, value2))

Anonymous
Not applicable

Also, an alternative to using the OR function that bsas suggested is to use || for the Or component. This will allow you to layer up multiple OR conditions, while the OR DAX Function only allows two variables to be compared.

View solution in original post

Anonymous
Not applicable

 

This is one way to do it

 

Measure = 
CALCULATE (
    ABS ( SUM ( 'BalanceteGeral'[Saldo] ) ),
    FILTER(BalanceteGeral, BalanceteGeral[Conta] >= 11),
FILTER(BalanceteGeral, BalanceteGeral[Conta] <= 13) )

 

 

A few alternatives to this could be applied, however would imagine for the situation you presented this should work.

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors