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á, poderiam ajudar com essa situação.
Tenho essa pequena tabela para exemplificar.
Preciso contar as linhas, para isso uso a COUNTA, e até aí tudo certo, agora vem o problema:
Imagina que estou executando um filtro no Dashboard com a data do dia 15/04/2022.
Preciso que ele conte os itens com os ID's 3, 5, 6. (total de 3)
A situação é contar os itens no estoque nessa data (15/04/2022). Então não posso considerar se entrou ou saiu dia 15, preciso considerar o período "ENTRE" das colunas dtatende e dtsaida.
Se alguém puder ajudar, serei grato. anexo está o fixeiro
@JeniferNunes , Assume you have disconnected date table to select dates
new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return
calculate( sum(Table[Value]), filter('Table', 'Table'[Start Date] <=_max && ('Table'[End Date] >=_max || isblank('Table'[End Date]) ) ))
Olá @amitchandak obrigado por me ajudar.
Porém não deu carto aqui, não sei se entendi o que quis dizer... Veja como fiz.
Coloquei a data de ínicio no dia 12/04/2022 e só apareceu o ID "6", nem os outros ID 3 e 4, que também entram no dia12/04/2022 apareceram...
Espero que já tenha resolvido.
Tenho que te dizer que sua dúvida me foi muito útil e a resposta do amitchandak também. Para outra pessoas que estiverem com a mesma dúvida, segue:
new measure =
VAR _max =
MAXX ( ALLSELECTED ( 'CALENDÁRIO' ), 'CALENDÁRIO'[Data] )
VAR _min =
MINX ( ALLSELECTED ( 'CALENDÁRIO' ), 'CALENDÁRIO'[Data] )
RETURN
CALCULATE (
COUNTROWS ( Planilha1 ),
Planilha1[Dtatende] >= _min
&& Planilha1[Dtsaida] <= _max
|| ISBLANK ( Planilha1[Dtsaida] )
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 32 | |
| 31 | |
| 18 | |
| 12 | |
| 11 |