Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
C1109
Contributor III
Contributor III

Grouping fields

Hi Qlik guys, 

This is probably a very straight forward query but I can't figure it out! 

I have 24 fields called RES_1 through to RES_24 (data within could by Y, N or blank but I want them included regardless of what the entry is) and I want to group them into a new field called GROUP consisting of Group 1, Group 2, Group 3 etc:

RES_1, RES_2, RES_9, RES_17, RES_21 would form "Group 1"
RES_3, RES_8, RES_15, RES_16 would form "Group 2"
RES_4, RES_5, RES_6, RES_7 would form "Group 3"
RES_10, RES_11, RES_14, RES_19 would form "Group 4"
and the remainder would form "Group 5"

Thanks in advance

Labels (1)
  • group

1 Solution

Accepted Solutions
Or
MVP
MVP

That's a little bit trickier, but still not too bad...

Groups:

Load YourKeyFields, If(Group_1 = 'Y','Group 1') as Groups

Resident YourTable;

CONCATENATE

Load YourKeyFields, If(Group_2 = 'Y','Group 2') as Groups

Resident YourTable;

etc.

 

View solution in original post

9 Replies
Or
MVP
MVP

What is the definition of a "group" in this context?

C1109
Contributor III
Contributor III
Author

It's simply the naming convention for a drill down...

I want to be able to highlight which Groups are present against a record 

e.g. Item A has RES_1 and RES_3 selected as Y
therefore Item A has entries against Groups 1 and 2

C1109
Contributor III
Contributor III
Author

Should also have added that I want to be able to select Group 1 and see a list of which Items have any RES fields selected from that Group

Or
MVP
MVP

If I understand that correctly, it looks like it's just a set of If() statements, e.g.

if(RES_1='Y" OR RES_2 = 'Y' or RES_9  = 'Y' or RES_17 = 'Y' or  RES_21= 'Y','Y') as Group 1

C1109
Contributor III
Contributor III
Author

I've just tried one Group first and get the error: Field '’Y’' not found

If(RES_1 =’Y’ or RES_2 =’Y’ or RES_9 =’Y’ or RES_17 =’Y’ or RES_21 =’Y’,'Y') as GROUP_1,

Or
MVP
MVP

Looks like a quotes issue - it should be a standard straight single quote / apostrophe (as with the last 'Y' in the statement you pasted), AKA ASCII code 39. All of your other 'Y's seem to have  curly quotes.

C1109
Contributor III
Contributor III
Author

Just noticed that... I'd been formatting in Word to try various options... changed font now and it's copying across correctly 🤕

I've got that working now as a Filter Pane... thank you! 

I guess the next question now is how to get those individual groups into one field? 

Hex_0-1622730327037.png

 

Or
MVP
MVP

That's a little bit trickier, but still not too bad...

Groups:

Load YourKeyFields, If(Group_1 = 'Y','Group 1') as Groups

Resident YourTable;

CONCATENATE

Load YourKeyFields, If(Group_2 = 'Y','Group 2') as Groups

Resident YourTable;

etc.

 

C1109
Contributor III
Contributor III
Author

Thank you so much for your help! 

Have now got everything working exactly as required 😀