Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
bhaveshp90
Creator III
Creator III

How can we create another field combining two fields?

Hello, 

I have created the below filter;

If(Cost_Code = '3', 'Mechanical Engineering',
If(Cost_Code = '4', 'Controls Engineering')) as Engineering_Area

 I am trying to combine both '3' and '4' to get the Total as another field in Engineering_Area. 

Can anyone please help me how to do this? I have attached the script in the qvd file. 

Labels (3)
1 Solution

Accepted Solutions
sunny_talwar

Maybe create a link table like this

LinkTable:
LOAD DISTINCT Engineering_Area,
	 Engineering_Area as New_Engineering_Area
Resident Project_Cost2
Where Len(Trim(Engineering_Area)) > 0;

Concatenate (LinkTable)
LOAD DISTINCT Engineering_Area,
	 'Total' as New_Engineering_Area
Resident Project_Cost2
Where Len(Trim(Engineering_Area)) > 0;

and now the New_Engineering_Area will have a new value called 'Total'

image.png

View solution in original post

13 Replies
vishsaggi
Champion III
Champion III

Can you let us know your expected output you want to see in your Engineering_Area field? And your qvw file is failing and unable to open it. 

sunny_talwar


@bhaveshp90 wrote: 
I am trying to combine both '3' and '4' to get the Total as another field in Engineering_Area. 

Can you elaborate on what exactly do you mean by this?

bhaveshp90
Creator III
Creator III
Author

Hi @sunny_talwar,  I am trying to add Total (Cost_Code = '3' and Cost_Code = '4') to Engineering_Area. 

So that my Engineering_Area has three fields; Mechanical Engineering, Controls Engineering, and Total. 

bhaveshp90
Creator III
Creator III
Author

@vishsaggi I want to Add Total to my Engineering_Area; where Total = (Cost_Code ='3' + Cost_Code = '4')

1.PNG

 

 

 

I've attached the file again now. 

vishsaggi
Champion III
Champion III

Did you replaced the file onto your first thread or did you missed attaching. I do not see the qvw file attached.
bhaveshp90
Creator III
Creator III
Author

@vishsaggi please find the attachment here, I've attached in my question but I don't know why you are unable to see it. 

vishsaggi
Champion III
Champion III

Ok your Cost_Code field has two values 3 and 4 when you say you want total what should happen when you select total. As at a time either you will have costcode 3 or 4 not both right?
bhaveshp90
Creator III
Creator III
Author

@vishsaggi I am trying to make Area as a filter in my report;

When I select Total it should show both values Sum(Cost_Code = 3 + Cost_Code =4)

My Area should have 3 fields I can select = Cost_Code =3, Cost_Code =4, Sum(Cost_Code = 3 + Cost_Code =4)


1.PNG

 

bhaveshp90
Creator III
Creator III
Author

@sunny_talwar Can you please help me with this problem?