Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
kaustubh
Creator
Creator

Counting values overlapping in two arrays

Hi everyone.

I have a data set as follows:

duration         Code 

15                      OVH

20                      DEM

25                      CVR

30                      FUV

15                      FUV

15                      ADD

25                      ADD

30                      CVR

...

I have to count the total number of codes falling in categories 20,25,30 which actually belongs to category of 15. (Simply saying - the codes from 20,25,30 that match the ones in 15 are to be counted). I also have to find the count of each codes falling outside 15. Example:

Total codes same as 15 that are outside = 100000K

FUD Total outside 15 = 28k

FUD in 20  = 14k

FUD in 25  = 10k

FUD in 30 = 4k 

CVR Total outside 15 = 5k

CVR in 20 = 1.7k

CVR in .... and so on for all codes

 

Can some one suggest a decent coding technique to find these measures.

 

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Front end or load? In the front, you could use a set expression like:

Sum({<duration -= {15}, Code = P({<duration = {15}>} Code)>} ...

That is, consider records where the duration is not 15, for codes that have at least one duration of 15.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
kaustubh
Creator
Creator
Author

In Set Analysis. Also I would Only Like to take the Labels and their counts if the count of those labels in 20, 25, 30 is less than their count in 15

Ex:

CVR = 200 for 15 and CVR 126 for 20 Then I dont wanna take CVR count

But if FUV = 200 for 15 and and FUV = 331 for 20 then take FUV

 

Any quick modifications to above one. I am just new to Qlik Sense hence cannot figure out the syntax. Any suggestions are welcome here.

kaustubh
Creator
Creator
Author

I wish to write it in Set OR Front !