Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ShellyG
Creator
Creator

One field value associated with more than one values from another field

Hi Community, 

I need help with an expression example for the following situation.

I have a simple dataset where I have a field, which contains group names - Group1, Group2, etc... I also have a field containing group codes - A, B, C and D.

Each of these groups can have either one of the codes or multiple codes.  For example:

Group1 - A
Group2 - A, B, C
Group3 - C, D

I want to create an additional field in my script, which will identify the groups that have multiple codes as 'Multiple' and the groups that have only one code as 'One'. 

Can you please help me with a sample expression of how to achieve that? 

Best Regards, 

Shelly

1 Solution

Accepted Solutions
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi  @ShellyG , you can add that field in the following way:

...

Left Join(GroupNameTable)

Load

   GroupName,

   If(Count(Distinct GroupCode) > 1, 'Multiple', 'One')  AS MultipleField

Resident GroupCodeTable

Group By GroupName;

...

JG

View solution in original post

1 Reply
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi  @ShellyG , you can add that field in the following way:

...

Left Join(GroupNameTable)

Load

   GroupName,

   If(Count(Distinct GroupCode) > 1, 'Multiple', 'One')  AS MultipleField

Resident GroupCodeTable

Group By GroupName;

...

JG