Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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_

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

May be like this

Dimension

Matriz

Expression

Count(DISTINCT Cidade)

Thiago_Justen_

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_

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_

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_

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!!!