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: 
abc_18
Creator II
Creator II

Need to combine two values from a field to a single value in the same field

Hi,

I have a field say column with values as:

Column:

A

B

C

D

E

my requirement is to add two values together and make it as a single value in same column like below:

A

B+C as ' new name'

C+D as 'new name1'

E

please let me know how to achieve this.

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

as below

 

Load * Inline [

Compliance,ComplianceGroup,ComplianceGroup_v2

Not approved to have XYZ,Not approved to have XYZ+Have latest version of XYZ,NonCompl for XYZ

Have latest version of XYZ,Not approved to have XYZ+Have latest version of XYZ,NonCompl for XYZ

Machine to have data,Machine to have data,Machine to have data

Machine to have data,Machine to have data+Have latest version of ABC,NonCompl for ABC

Have latest version of ABC,Machine to have data+Have latest version of ABC,NonCompl for ABC

Machine to have running,Machine to have running,Machine to have running

];

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

11 Replies
Mark_Little
Luminary
Luminary

Hi,

Your not far from it already. 

LOAD

A,

B&C as ' new name',

C&D as 'new name1',

E,

 

From ...

If they are numbers then you can use the + to sum them instead of the &. 

vinieme12
Champion III
Champion III

best to Rangesum() to avoid issues with sum'ing null values

 

Column:

LOAD

A

,B

,C

,D

,E

,Rangesum(B,C) as newfield1

,Rangesum(C,D) as newfield2

From SomeDataSource;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
abc_18
Creator II
Creator II
Author

Hello everyone, thanks for the response.

I tried above but it's not working. may be the explanation was not clear.

Actually have a compliance column in a table and need to add two values from compliance column to show the count .

load

Compliance,

OS,

OS Type

from xyz;

in that Compliance column have these 6 values as A,B,C,D,E,F and need to show the combined count of B&C and E&F in a bar chart.

I know how to combine two diff fields but my question is how to combine a field values to make  one value and show the count in bar chart like below.

abc_18_0-1667290095774.png

 

 

 

vinieme12
Champion III
Champion III

create a new field which groups values as below

 

Temp:

Load * Inline [

ComplianceType,Value

A,10

B,10

C,10

D,10

E,10

F,10

];

 

Grouping:

Load * inline [

ComplianceType,ComplianceGroup

A,A

B,B+C

C,B+C

D,D

E,E+F

F,E+F

];

 

Now use Dimension

=ComplianceGroup

Measure

=sum(Value)

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
abc_18
Creator II
Creator II
Author

Hi Vineeth,

Thanks for the response.

but have a question what to provide in value column in first inline load.

My compliance column contains values like (Compliance, Not compliance, overall and so on.....) and against these I am showing count of machines in bar chart (expression)

vinieme12
Champion III
Champion III

whats important is the Grouping table 

Just make sure to group your dimension values correctly and Use the ComplianceGroup field in your chart

 

Your measures will automatically aggregate based in the grouped values

Dimension:

ComplianceGroup

Measure

=Count(Something)

 

example

Grouping:

load * inline[

Compliance,ComplianceGroup

Compl,Compl

NonCompl,NonCompl

Compl,Compl+NonCompl

NonCompl,Compl+NonCompl

];

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
abc_18
Creator II
Creator II
Author

Hi Vineeth,

For single compliance value, numbers are populating correctly like for 'A' and 'D' but for values where I am doing addition (grouping) it's  not working. My measures is automatically aggregating only for single values but for group values it's just coming as unassigned data like '-' and there can see the remaining count.

 

vinieme12
Champion III
Champion III

Can you post some screenshots of Your data model  that shows association with the Inline table created for grouping

 

Also post all values in your compliance field and your script as to how you've grouped them in the Inline table

 

If your grouped values are not associated correctly that would only mean the values don't match in both the tables 

For example a value "a" is not same as "A"

Th values must match exactly including spaces 

 

 

 

 

 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
abc_18
Creator II
Creator II
Author

Hi Vineeth,

Yes, you are correct, there is data issue that's why the association isn't working.

I looked through the data model and saw that we are giving new names to the values we are adding up, as shown by the bolded text, so that the new names can be seen in the bar chart.

Below is the sample of Script from my app

Grouping:

load * inline[

Compliance,ComplianceGroup

NonCompl for XYZ,Not approved to have XYZ+Have latest version of XYZ
NonCompl for ABC,Machine to have data+Have latest version of ABC
Machine to have data , Machine to have data
Machine to have running , Machine to have running

]; 

And in Compliance column values are as below:

Compliance

Not approved to have XYZ

Have latest version of XYZ

Machine to have data

Have latest version of ABC

Machine to have running

For values 'Machine to have data' and 'Machine to have running' association are working because they are linked but this not in the case where we are adding values.

Can you please suggest what can I change to make this work?