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
lfregnani
New Member

Contando resultados filtrados

Boa noite,

 

Tenho uma Tabela em MySQL e estou tentando contar o número de resultados filtrados na consulta!

o esquema do banco é:

 

+--------+------------------------+------------------------+----------------------+---------------------+
|   ID   |       TN		  |       Assunto          | Estado_do_ticket     |        Data         |
+--------+------------------------+------------------------+----------------------+---------------------+
|  1     | 1234567890001          | Troca de mouse         |        1             | 2018-04-01 08:30:00 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  2     | 1234567890002          | Teclado                |        2             | 2018-04-05 10:40:55 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  3     | 1234567890003          | Formatacao             |        2             | 2018-04-06 11:55:00 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  4     | 1234567890004          | Memória ram            |        4             | 2018-04-06 17:40:00 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  5     | 1234567890005          | Parafuso solto         |        4             | 2018-04-10 07:20:00 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  6     | 1234567890006          | Explorer               |        3             | 2018-04-11 11:30:00 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  7     | 1234567890007          | Excel                  |        3             | 2018-04-12 08:55:07 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  8     | 1234567890008          | Pacote Office          |       10             | 2018-04-13 14:55:00 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  9     | 1234567890009          | Não abre internet      |       10             | 2018-04-14 15:59:09 |
+--------+------------------------+------------------------+----------------------+---------------------+
|  10    | 1234567890010          | não liga               |        2             | 2018-04-15 16:58:58 |
+--------+------------------------+------------------------+----------------------+---------------------+

 

 

1 - Novo

2 - Fechado

3 - Fechado sem exito

4 - Aberto

10 - Fechado solução de contorno

 

Na minha query no workbench a consulta fica assim:

Select count(id) as fechados,((Select count(id) as criados
from ticket 
where data between '2018-04-01 00:00:00' 
and '2018-04-20 23:59:59')) as criados
from ticket
where data between '2018-04-01 00:00:00' 
and '2018-04-20 23:59:59'
and ticket_state_id in (2,3,10);

O resultado:

+----------+---------+
| Fechados | Criados |

+----------+---------+
|       7        |     10      |
+----------+---------+

 

O relatório para os criado é criado perfeitamente, mas os fechados não estão conseguindo obter o mesmo resultado já que preciso filtra-los por =2,3,10. Consegui algum resultado com esta formula no dax studio

Evaluate

FILTER ( 'ticket' , [estado_do_ticket] = "2") 

 

Mas no Power bi recebo a mensagem: A expressão faz referência colunas. Não é possivel converter várias colunas em um valos escalar.

 

Alguem pode me ajdar?

 

3 REPLIES 3
v-jiascu-msft
Employee
Employee

Hi @lfregnani.

 

Da tradução do Google:
Você pode compartilhar a fórmula completa do DAX? A fórmula da peça que você postou parece boa. Se você puder compartilhar o arquivo inteiro, isso seria ótimo.
Por que não usar o slicer para filtrar?

 

Can you share the complete DAX formula? The part formula you posted seems good. If you can share the whole file, that's would be great.
Why not using the slicer to filter?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-jiascu-msft

 

Here is my file .
The formula works with dax studio, where I need to count the records containing the values ​​2, 3 and 10 of the column ticket_state_id

Hi @lfregnani,

 

I wonder if the measure below can give the result you want.

Measure =
CALCULATE (
    COUNT ( ticket[ticket_state_id] ),
    ticket[ticket_state_id] IN { 2, 3, 10 }
)

Contando_resultados_filtrados

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.