Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Clever_Anjos
Employee
Employee

Help with Set Analysis and aggregation

I have a dataset like below (excel file attached too)

I need to know (aggregated on [ID Som]) how many segments have a [ID Som] that have a segment = Silence of Duration between 22  and  66 (example) and also have segments = MUSIC of duration between 5 and 20.

In this sample I should have:

  • 787 - 4
  • 882 - 0 (It has SILENCE but hasn´t MUSIC)

   

ID SomID SegmentoTipo SegmentoDuration
7875923VOICE23,30
7875924SILENCE8,23
7875925VOICE1,84
7875926SILENCE4,73
7875927VOICE1,65
7875928SILENCE29,22
7875929VOICE13,34
7875930SILENCE3,68
7875931VOICE16,36
7875932SILENCE51,37
7875933MUSIC5,43
7875934SILENCE4,78
7875935VOICE2,61
7875936SILENCE3,47
7875937VOICE11,54
7875938SILENCE10,27
7875939VOICE9,09
7875940MUSIC9,33
7875941SILENCE9,77
7875942VOICE24,22
8826640VOICE68,25
8826641SILENCE53,06
8826642VOICE7,69
8826643SILENCE10,00
8826644VOICE6,35
8826645SILENCE8,24
8826646VOICE13,62
8826647SILENCE6,91
8826648VOICE69,60
1 Solution

Accepted Solutions
sunny_talwar

May be this:

=Count(DISTINCT {<[ID Som] = {"=(Count({<[Tipo Segmento] = {'SILENCE'}, [Duracao Segmento] = {'>=22<=66'}>}[Duracao Segmento]) > 0 and

  Count({<[Tipo Segmento] = {'MUSIC'}, [Duracao Segmento] = {'>=5<=20'}>}[Duracao Segmento]) > 0)"}>*

  (<[Tipo Segmento] = {'SILENCE'}, [Duracao Segmento] = {'>=22<=66'}>+<[Tipo Segmento] = {'MUSIC'}, [Duracao Segmento] = {'>=5<=20'}>)} [ID Segmento])


Capture.PNG

View solution in original post

9 Replies
sunny_talwar

What ID Segmento are getting included here?

Clever_Anjos
Employee
Employee
Author

it´s the "id" of each row

sunny_talwar

but how did you get 4 for 787? I am having difficulty in understanding how you got that number.

Clever_Anjos
Employee
Employee
Author

It´s the "count of ok"

     

ID SomID SegmentoTipo SegmentoDuracao SegmentoCheck
7875924SILENCE8,23outside threshold < 22
7875926SILENCE4,73outside threshold < 22
7875928SILENCE29,22ok between 22 and 66
7875930SILENCE3,68outside threshold < 22
7875932SILENCE51,37ok between 22 and 66
7875933MUSIC5,43ok between 5 and 20
7875934SILENCE4,78outside threshold < 22
7875936SILENCE3,47outside threshold < 22
7875938SILENCE10,27outside threshold < 22
7875940MUSIC9,33ok between 5 and 20
7875941SILENCE9,77outside threshold < 22
othniel2014
Contributor III
Contributor III

882 -  0...It is not? ---> 882  - 1

8826641SILENCE53.062266
Clever_Anjos
Employee
Employee
Author

No, because it has no MUSIC segment between 5 and 20

sunny_talwar

May be this:

=Count(DISTINCT {<[ID Som] = {"=(Count({<[Tipo Segmento] = {'SILENCE'}, [Duracao Segmento] = {'>=22<=66'}>}[Duracao Segmento]) > 0 and

  Count({<[Tipo Segmento] = {'MUSIC'}, [Duracao Segmento] = {'>=5<=20'}>}[Duracao Segmento]) > 0)"}>*

  (<[Tipo Segmento] = {'SILENCE'}, [Duracao Segmento] = {'>=22<=66'}>+<[Tipo Segmento] = {'MUSIC'}, [Duracao Segmento] = {'>=5<=20'}>)} [ID Segmento])


Capture.PNG

Clever_Anjos
Employee
Employee
Author

You are the GUY!

Clever_Anjos
Employee
Employee
Author

While this I´ve reached this "ugly"  expression too

Sum(

  Aggr(

  If(

  Count(if(([Duracao Segmento]>=5 and [Duracao Segmento]<=20 and [Tipo Segmento]='MUSIC'), [ID Segmento])) > 0 and

  Count(if(([Duracao Segmento]>=22 and [Duracao Segmento]<=66 and [Tipo Segmento]='SILENCE'), [ID Segmento])) > 0 ,

  Count(if(([Duracao Segmento]>=5 and [Duracao Segmento]<=20 and [Tipo Segmento]='MUSIC'), [ID Segmento])) + Count(if(([Duracao Segmento]>=22 and [Duracao Segmento]<=66 and [Tipo Segmento]='SILENCE'), [ID Segmento])) ),

  [ID Som]

  )

)