Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Bom dia,
Eu gostava de fazer uma fórmula em dax onde gostaria que houvesse um dos filtros que fosse baseado em duas tabelas distintas como mostra a fórmula:
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])
)
)
Ela não dá erro mas não retorna nenhum tipo de dados.
I want to do a filter that only filters if he matches 2 conditions (
'Tipo Contrato'[Código Tipo Contrato] = "73"
and
'Grupo Empregado'[Código Subgrupo Empregado] IN {"B5", "C5", "L5"}but they are from different tables.
Thanks for the reply from Sahir_Maharaj please allow me to provide another insight:
Could you please let us know if Sahir_Maharaj 's response resolved your issue? If it did, kindly accept it as the solution.
Since we don't have the complete test data, we can't accurately determine if Sahir_Maharaj 's response has resolved your issue. If you need our assistance, please provide the relevant data structure information, especially the table relationships, so we can test our solution effectively.
We recommend uploading it to GitHub and sharing the link with us.When uploading a file, please be careful to delete sensitive information.
For questions about uploading data, you can try the following links:
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Solved: How to upload PBI in Community - Microsoft Fabric Community
Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
Hello @josegracaaxians,
Can you please try this approach:
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(
COUNTROWS('Tipo Contrato'),
FILTER('Tipo Contrato', 'Tipo Contrato'[Código Tipo Contrato] = "73")
) > 0
),
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])
)
)
hey, it doesnt fit cause I cant use it to some visuals:
Here, for example it would only show the 192!
To better assist you in resolving the issue, we need you to provide relevant information about your data structure, particularly the table relationships. This will help us effectively test and optimise our solution.
We recommend that you upload this information to GitHub and share the link with us. When uploading the files, please ensure that any sensitive information is removed to maintain data security.
For questions about uploading data, you can try the following links:
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Solved: How to upload PBI in Community - Microsoft Fabric Community
Thank you for your cooperation!
Best Regards,
Leroy Lu
Here is the sample data:
https://drive.google.com/file/d/1uhkfYWKn6Jkaip4Zh3j1ww2Ahb-w3ZCh/view?usp=sharing
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
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.