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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply

Measure with many filters and 2 and one of them on 2 different tables

 

Hey, have a great year,

I would like to make a measure where I could have many filters and one of them based in two distinct tables as i show here:

 

Measure = 
CALCULATE(
    SUM('Caracterização Efetivo'[Número Empregados]),
    FILTER(
        'Grupo Empregado',
        'Grupo Empregado'[Código Grupo Empregado] IN {"B", "C", "L"}
    ),
    FILTER( 
        'Grupo Empregado',
        'Grupo Empregado'[Código Subgrupo Empregado] IN {"B3", "B4", "B6", "B7", "C3", "C4", "C6", "C7", "L3", "B9", "C9", "L8", "L4"} 
    ),
    FILTER('Grupo Empregado',
            'Grupo Empregado'[Código Subgrupo Empregado] IN {"B5", "C5", "L5"} 
            && 
            CALCULATE(
                SUM('Caracterização Efetivo'[Número Empregados]),
                FILTER( 'Tipo Contrato',
                'Tipo Contrato'[Código Tipo Contrato] = "73")
            )),

    FILTER(
        'Unidade Organizacional',
        'Unidade Organizacional'[Código Autoridade Controlo Efetivos] = "5"
    ),
    FILTER(
        'Estado Ocupação',
        'Estado Ocupação'[Código Estado Ocupação] IN {"1", "3"}
    ),
    FILTER(
        'Caracterização Efetivo',
        'Caracterização Efetivo'[ID_MES] = MAX('Caracterização Efetivo'[ID_MES])
    )
)

 

It doesnt gives errors but doesnt retrive any type of errors.

 

I want to do a filter that only filters if he matches 2 conditions (and dont colapse other filters): 

'Tipo Contrato'[Código Tipo Contrato] = "73"

 and 

 'Grupo Empregado'[Código Subgrupo Empregado] IN {"B5", "C5", "L5"}

 but they are from different tables.

 

This 3 tables are related with only 2 relationships:

Caracterização Efetivo -> (Many -to-one)Grupo Empregado with  ID_GRUPO_EMPREGADO

Caracterização Efetivo -> (Many -to-one)Tipo de Contrato with ID_TIPO_CONTRATO

josegracaaxians_0-1736165630189.png

 

 

4 REPLIES 4
lbendlin
Super User
Super User

Instead of using FILTER you can use TREATAS

 

Personally I would create a variable for the MAX [ID_MES]  to avoid any unintended context side effects.  You can use EVALUATEANDLOG to see where your measure breaks down.

Can u help me more please?

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors