Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Olá,
Sou novato com medidas DAX e estou com dificuldade para solucionar um problema. Preciso obter as médias de preços dos produtos. Porém o cálculo deve considerar apenas os produtos que possuem dados em todos os anos selecionados. Por exemplo o cód A tem dados em 2018, 2019 e 2020, o código B em 2018 e 2019, nesse caso a média deve ser apenas do código A. Caso seja segmentado apenas os anos de 2018 e 2019 então o código B pode ser calculado. Parece simples, porém com meus conhecimentos não sou capaz de encontrar uma fórmula que faça isso. Segue exemplo da tabela:
Solved! Go to Solution.
Hi @Josué ,
Please try the following formula:
Measure =
IF (
CALCULATE ( DISTINCTCOUNT ( 'Table'[Year] ), ALLSELECTED ( 'Table' ) )
= DISTINCTCOUNT ( 'Table'[Year] ),
AVERAGE ( 'Table'[Value] )
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Josué ,
Please try the following formula:
Measure =
IF (
CALCULATE ( DISTINCTCOUNT ( 'Table'[Year] ), ALLSELECTED ( 'Table' ) )
= DISTINCTCOUNT ( 'Table'[Year] ),
AVERAGE ( 'Table'[Value] )
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Josué , Try like
AverageX(Summarize(Table, Table[Year], Table[Product], "_1", Sum(Table[Price])),[_1])
or
calculate(AverageX(Summarize(Table, Table[Year], Table[Product], "_1", Sum(Table[Price])),[_1]), allexcept(Table, Table[Product])
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 14 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 10 | |
| 10 | |
| 6 | |
| 6 |