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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Gelain
Frequent Visitor

Calculate with more than one filter

Hello!

 

How do I apply two or more filters in the same query?

 

Query= CALCULATE([Valores Totais];'Sintético'[Tipo]="Outros") +CALCULATE([Valores Totais];'Sintético'[Tipo]="Receitas")

 

Thank you!

2 ACCEPTED SOLUTIONS

@Baskar- you are correct that a measure will allow FILTER() function within CALCULATE().

 

However I believe the suggestion from @tringuyenminh92 will not produce the desired results because it uses an AND (&&) clause and should use an OR ( || ) clause.

 

So either formula should work in most situations.

 

Query =
CALCULATE (
    [Valores Totais],
    FILTER ( Sintetico, Sintetico[Tipo] = "Outros" || Sintetico[Tipo] = "Receitas" )
)
Query =
CALCULATE (
    [Valores Totais],
    Sintetico[Tipo] = "Outros"   ||
    Sintetico[Tipo] = "Receitas"
)

View solution in original post

Baskar
Resident Rockstar
Resident Rockstar

Try this one 

 

Query =
CALCULATE (
[Valores Totais],
OR (Sintetico[Tipo] = "Outros" , Sintetico[Tipo] = "Receitas")
)

 

It is not solve your prob share some sample data 

View solution in original post

7 REPLIES 7
tringuyenminh92
Memorable Member
Memorable Member

Hi @Gelain,

 

you could put them inside filter method:

 

Query= CALCULATE([Valores Totais],filter(Sintético,'Sintético'[Tipo]="Outros" && 'Sintético'[Tipo]="Receitas" ) )

If this works for you please accept it as solution and also like to give KUDOS.

Best regards
Tri Nguyen

Hi @tringuyenminh92!

 

I installed the latest version of Power BI and only accepted without the filter:

 

Query = CALCULATE([Valores Totais];('Sintético'[Tipo]="Receitas" || 'Sintético'[Tipo]="Despesas"))

 

What do you think?

 

Thank you!

 

Gelain

Baskar
Resident Rockstar
Resident Rockstar

No way . Am 100% sure measure and cal column should allow filter.

 

one question for do u using any Live connection ?

 

 

@Baskar- you are correct that a measure will allow FILTER() function within CALCULATE().

 

However I believe the suggestion from @tringuyenminh92 will not produce the desired results because it uses an AND (&&) clause and should use an OR ( || ) clause.

 

So either formula should work in most situations.

 

Query =
CALCULATE (
    [Valores Totais],
    FILTER ( Sintetico, Sintetico[Tipo] = "Outros" || Sintetico[Tipo] = "Receitas" )
)
Query =
CALCULATE (
    [Valores Totais],
    Sintetico[Tipo] = "Outros"   ||
    Sintetico[Tipo] = "Receitas"
)

@jmalone Thank you!

Baskar
Resident Rockstar
Resident Rockstar

Try this one 

 

Query =
CALCULATE (
[Valores Totais],
OR (Sintetico[Tipo] = "Outros" , Sintetico[Tipo] = "Receitas")
)

 

It is not solve your prob share some sample data 

Gelain
Frequent Visitor

@Baskar Thank u!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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