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

Aggr through selections and show most common value for each selection

Hello All,

I have an AndMode listbox with Products. Each product is made up of a number of parts. When a product is selected in the AndMode listbox, I have an expression that shows the number of common parts between the selected product and the rest of the products.


Ex:

Product     Parts

P1            A, B, C, D, E

P2            A, F, G, H

P3            C, E, F, I

P4            A, B, E, G, J

P5            C, E, F, G, H



When P1 is selected, the following is seen:


P1     5

P2     1               (since P2 shares 1 common part with the selected Product P1)

P3     2               (since P3 shares 2 common parts with the selected Product P1)

P4     3               (since P4 shares 3 common parts with the selected Product P1)

P5     2               (since P5 shares 2 common parts with the selected Product P1)



So when P1 is selected, it can be seen that P4 has the highest number of shared parts with P1 than the other products.


I want to find a way to show each product's most common product.

For example, the table would look like the following without having to manually select each product individually:


Product     Most Similar to

P1                    P4

P2                    P4

P3                    P5

P4                    P1

P5                    P3

Is there a way to aggregate through selections and list out the most common product for each selected product?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached. If that's not good enough then try calculating the Levenshtein Distance: Fuzzy Matching/Joining


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

See attached. If that's not good enough then try calculating the Levenshtein Distance: Fuzzy Matching/Joining


talk is cheap, supply exceeds demand
drewwilliams
Contributor III
Contributor III
Author

Thank you, though it didn't give me exactly what I was looking for, the idea was there. A slight variation of your work gave me something closer to what I was looking for so thank you for your insight!