Search code examples
qliksense

Combining columns in Qlik


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.


Solution

  • 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:

    Data Manager

    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:

    Screenshot of Qlik Sense Data Manager adding a calculated field

    Then after you load the data, you will have a new field with the combined names:

    Screenshot of Qlik Sense dashboard with a table showing ETL results

    Data Load Editor

    Doing this in the Data Load Editor will also result in a new field and is the exact same expression (see line 6):

    Screenshot of Qlik Sense Data Load Editor adding a calculated field

    Chart expression

    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:

    Screenshot of Qlik Sense table properties with an on-the-fly expression

    Screenshot of Qlik Sense table result with an on-the-fly expression