I have an Excel sheet that has two seperate columns of data that I need combined for my table in Qlik. I know it would be easy to combine the two in the Excel document, but because this is a data feed I would prefer not to do any extra work. One column has the first name and the other the last. Thank you.
I tried to concat but that did not work.
It sounds like what you're trying to achieve is string concatenation, where you'd combine two or more strings together. It'd be the same concept for fields, as long as their values can be coerced to a string type. In Qlik, this is done very simply by using the ampersand &
operator. You can use this in three places:
If done in the Data Manager, you are creating a new calculated field. This can be done by editing the table that you're loading in from Excel, selecting Add field >> Calculated field, and then using an expression like this:
first_name & ' ' & last_name
What that expression is doing is taking the field first_name
and concatenating it's values with a space ' '
and then concatenating the values of the last_name
field.
So your new field, which I'm naming full_name
here, would look like this:
first_name | last_name | full_name |
---|---|---|
Chris | Schaeuble | Chris Schaeuble |
Stefan | Stoichev | Stefan Stoichev |
Austin | Spivey | Austin Spivey |
Here's what the data manager would look like:
Then after you load the data, you will have a new field with the combined names:
Doing this in the Data Load Editor will also result in a new field and is the exact same expression (see line 6):
The other option you have is to use this expression "on-the-fly" in a chart without creating a new column in the app data model like the first two options. Just use that same expression from above in a chart field expression and you'll get the same result: