Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Igomorf
Contributor II
Contributor II

Contagem de linhas com valores iguais entre duas colunas (comparação)

Olá, 

Estou começando a aprender sobre o Qlik Sense, mas me surgiu uma dúvida que não pude solucionar e nem encontrei nada por aqui sobre o tema, embora me pareça algo simples.

Então, preciso realizar uma contagem a ser exibida em um KPI que mostre a contagem de linhas com valores iguais entre duas colunas.

Por exemplo, na tabela abaixo, tenho 3 linhas onde os itens da coluna se repetem:

Tab.PNG

 

Assim, precisaria de um KPI que me mostrasse o valor "3".

Tentei fazer algo como: Count( {<[Subclasse FINAL]=[Subclasse inicial]>} [Subclasse inicial])

Mas essa expressão me retorna "0".

Se alguém tiver alguma ideia, ficaria muitíssimo agradecido!

Obrigado pela atenção e desculpem-me pela dúvida tão banal.

Abraço!

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

load

SubclassInicial

,SubclassFinal

,if(SubclassInicial=SubclassFinal,1,0) as flag_field

From SomeExcelfile.xlsx;

 

in KPI chart

=count({<flag_field={'1'}>}flag_field)

 

https://www.analyticsvidhya.com/blog/2014/01/set-analysis-qlikview/

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

8 Replies
vinieme12
Champion III
Champion III

Option 1]

Create a flag field in load script

 

Example:

load

Class

,SubClass

,if(Class=SubClass,1,0) as flag

from Xyzdatasource;

 

Then in chart use below expression

=count({<flag=1>}Something)

 

Option 2]    Inter-record set analysis

for this you would need a field that identifies each row uniquely

then your expression would be as below

=count({<IDfield={"=Class-Subclass"}>}something)

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Igomorf
Contributor II
Contributor II
Author

em:

=count({<flag=1>}Something)

O que seria o "Something"?

vinieme12
Champion III
Champion III

any measure that you need to count or sum 

=count({<flag=1>}1)

or do you just need to show this in a table without any measures?

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Igomorf
Contributor II
Contributor II
Author

Precisaria de um KPI que me mostrasse apenas o valor.

@vinieme12 , muito obrigado por estar tentando ajudar até aqui!

vinieme12
Champion III
Champion III

can you post some sample data in excel/text and  mockup of the expected output?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Igomorf
Contributor II
Contributor II
Author

BI-Moqups.JPG

vinieme12
Champion III
Champion III

load

SubclassInicial

,SubclassFinal

,if(SubclassInicial=SubclassFinal,1,0) as flag_field

From SomeExcelfile.xlsx;

 

in KPI chart

=count({<flag_field={'1'}>}flag_field)

 

https://www.analyticsvidhya.com/blog/2014/01/set-analysis-qlikview/

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Igomorf
Contributor II
Contributor II
Author

It worked, you are the best @vinieme12!!!! kkkkkkkkkkk... thank you so much!!!!!!