Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
gleybson_calyx
Contributor III
Contributor III

Hours repeated at the end of the month

Hi everyone, I need a set analysis that returns me what is in bold in this table below.
I'm creating a 3 KPI's and I need to display this information.
1st KPI has that returns me that throughout the month the value of 7h was repeated 8 times

datavalorhora  
02/01/20191615h 7h 8x
03/01/20191317h 8h 5x
04/01/20191414h 9h 4x
05/01/2019137h 8h 10h  
07/01/2019139h 11h 13h 17h  
08/01/20191413h  
09/01/2019137h 18h  
10/01/20191314h  
11/01/20191712h  
12/01/2019179h  
14/01/2019137h 18h 19h  
15/01/2019147h 9h  
16/01/2019137h 10h  
17/01/2019147h  
18/01/2019148h  
19/01/2019148h  
21/01/2019138h  
22/01/20191510h  
23/01/2019117h 8h 9h  
24/01/2019147h  
25/01/20191516h 17h  
26/01/20191710h  
28/01/2019157h  
29/01/2019137h 9h  
30/01/20191317h  
31/01/2019118h 10h 11h 13h  

 

 

Labels (1)
1 Solution

Accepted Solutions
Alessandra
Partner - Contributor
Partner - Contributor

Gleyson follow the solution. To solve this problem I always working in parts, I think is more easy.
 
count(
Aggr(
if(
max(Total <Dia>{<[Tipo Operação] = {'Carga'}>}
aggr(
count({<[Tipo Operação] = {'Carga'}
         >}distinct Placa), HoraEntrada, Dia)) = max({<[Tipo Operação] = {'Carga'}>}
  aggr(
                        count({<[Tipo Operação] = {'Carga'}
                               >}distinct Placa), HoraEntrada, Dia)), HoraEntrada),Dia, HoraEntrada))

View solution in original post

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm not clear on your logic. I count "7h" as appearing 10 times?

-Rob

gleybson_calyx
Contributor III
Contributor III
Author

Pedon, that's right, 10 times

dwforest
Specialist II
Specialist II

if you just need the 3, quick way without changing the source data (which would make counting any hour easier - see SubField function), use FindOneOf:
Sum(if(FindOneOf('7h', hora)>0,1,0))
Alessandra
Partner - Contributor
Partner - Contributor

Gleyson follow the solution. To solve this problem I always working in parts, I think is more easy.
 
count(
Aggr(
if(
max(Total <Dia>{<[Tipo Operação] = {'Carga'}>}
aggr(
count({<[Tipo Operação] = {'Carga'}
         >}distinct Placa), HoraEntrada, Dia)) = max({<[Tipo Operação] = {'Carga'}>}
  aggr(
                        count({<[Tipo Operação] = {'Carga'}
                               >}distinct Placa), HoraEntrada, Dia)), HoraEntrada),Dia, HoraEntrada))