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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
luisreyes
Frequent Visitor

How to filter with 2 condition in a measure

Hi,

 

Im trying to use CALCULATE with 2 filters: 

Measure= CALCULATE(SUM(Hoja2[Cantidad]),Hoja2[Tipo]="No Consumidos",Hoja2[Tipo]="Ligero No Consumido")
i want to filter by 2 types to sum (No Consumidos, Ligero No Consumido), 
 
I managed to graph with only 1 type but i need the 2 types, to make a graph like this:
 
luisreyes_0-1657827290738.png

 

 
1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @luisreyes ,

 

Please try:

Measure = 
CALCULATE(
    SUM('Hoja2'[Cantidad]),
        FILTER(
            'Hoja2',
            'Hoja2'[Tipo]="No Consumidos"
                ||'Hoja2'[Tipo]="Ligero No Consumido"
        )
)

or

Measure = 
CALCULATE(
    SUM('Hoja2'[Cantidad]),
        FILTER(
            'Hoja2',
            'Hoja2'[Tipo] IN {"No Consumidos","Ligero No Consumido"}       
        )
)

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @luisreyes ,

 

Please try:

Measure = 
CALCULATE(
    SUM('Hoja2'[Cantidad]),
        FILTER(
            'Hoja2',
            'Hoja2'[Tipo]="No Consumidos"
                ||'Hoja2'[Tipo]="Ligero No Consumido"
        )
)

or

Measure = 
CALCULATE(
    SUM('Hoja2'[Cantidad]),
        FILTER(
            'Hoja2',
            'Hoja2'[Tipo] IN {"No Consumidos","Ligero No Consumido"}       
        )
)

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

mariussve1
Solution Supplier
Solution Supplier

You should be able to filter multiple columns with CALCULATE().

 

Can you please look at this link for concept and get back if you still have any questions 🙂

https://www.sqlbi.com/articles/specifying-multiple-filter-conditions-in-calculate/

Br

Marius

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.