Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
cmorri1988
Creator
Creator

Complex set analysis question please....

Hi there,

I select several ID's and return 2 ID's for each ID selected, where Type and Class value match the selected ID.

The below example shows the selection of ID's 1 and 4 to return:

ID's 2 and 3 (first two records with same possible values for Type and Class as ID 1

ID's 5 and 6 (first two records same possible values for Type and Class as ID 4

  

  

Data
IDTypeClassSales
11A10
21A10
31A10
42C20
52C30
62C10
72C21
83D34
93D21
104D10
Resulting Table
IDTypeClassSales
21A10
31A10
52C30
62C10

I do this with,

If(Only({1<ID = p({<Type = p(Type), Class = p(Class), ID = e(ID)>})>}

Aggr(Rank(Only({1<ID = p({<Type = p(Type), Class = p(Class), ID = e(ID)>})>}-ID)), Type, Class, ID)) < 3,

Sum({1<ID = p({<Type = p(Type), Class = p(Class), ID = e(ID)>})>}[Sales]))

I would like to display the selected ID relevant to the result, such as...

  

ID

TypeClassSalesSelected ID
21A101
31A101
52C304
62C10  4

Please can anyone offer some advice on the correct set analysis expression to use?

I have also attached a small test Qlik Sense QVF.

Thanks!!

10 Replies
cmorri1988
Creator
Creator
Author

Hi,

The overall goal is to find comparative records with the same field values as the record selected.

Each record has a unique ID, but up to 50 fields within the data model holding metadata for that record.

For that reason, the only distinct value is ID, all other metadata fields are non distinct.

The comparative records are based on the seven fields quoted within the set, and if a '100% match' is selected for any of those fields, the resulting comparative record must have the same value for that field as within the selection.

As a user can select more than 1 ID to gain comparative results for each based on those seven fields, it is required that we display which selection the result is associated to.

I am unsure if we can do this currently, as there is no way to make each selection unique for the seven fields quoted within the set, and therefore no way of pointing the result to the correct selection and selected ID.

Thanks

Get Outlook for Android<https://aka.ms/ghei36>