Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
leonardovieiraj
Contributor II
Contributor II

FUNCAO COUNT

Bom Dia Pessoal!!!

Se eu tenho uma tabela de clientes com a estrutura:

Cliente  Matriz  Cidade

1            1          A

2            1          B

3            3          C

Como eu faço para criar uma tabela que o resultado seja o seguinte:

Matriz  Qtde Filiais

1           2

3           1

Obrigado!

Labels (2)
1 Solution

Accepted Solutions
Thiago_Justen_
MVP
MVP

Seria algo assim:

Table:

LOAD * INLINE [

Cliente,  Matriz,  Cidade

1,            1,          A

2,            1,          B

3,            3,          C

];

Final:

LOAD

Matriz,

    Count(DISTINCT Cliente) as Qtde_Clientes

Resident Table Group By Matriz;

Drop Table Table;

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago

View solution in original post

8 Replies
sunny_talwar
MVP
MVP

May be like this

Dimension

Matriz

Expression

Count(DISTINCT Cidade)

Thiago_Justen_
MVP
MVP

O stalwar1 já respondeu sua pergunta, mas se houver necessidade de verificar a quantidade de filiais por cidade por exemplo, você pode usar:

Dimensão: Matriz

Expressão: Count(Aggr(Count(Distinct Cliente),Cidade))

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
leonardovieiraj
Contributor II
Contributor II
Author

Tks Sunny,

But it's not that simple.

I need to create a table.by script to use with other information.

It's possible???

Thiago_Justen_
MVP
MVP

Leonardo,

Give us more details about your issue then we'll provide you a good solution.

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
leonardovieiraj
Contributor II
Contributor II
Author

Thiago, obrigado pelas informação, mas eu consigo usar essa expressão numa script de carga???

Thiago_Justen_
MVP
MVP

Seria algo assim:

Table:

LOAD * INLINE [

Cliente,  Matriz,  Cidade

1,            1,          A

2,            1,          B

3,            3,          C

];

Final:

LOAD

Matriz,

    Count(DISTINCT Cliente) as Qtde_Clientes

Resident Table Group By Matriz;

Drop Table Table;

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
Thiago_Justen_
MVP
MVP

Resultado do script:

Capturar.PNG

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
leonardovieiraj
Contributor II
Contributor II
Author

Era justamente o que eu precisava! Thiago Muitíssimo Obrigado!!!