Qlik Front End: Concat 2 rows into one

67 Views Asked by At

Morning,

This question is for front end development only:

I have a bar chart. The dimension is County and the measure is population. I want to combine 2 counties together into 1 bar.

County Population
Montgomery 8,000
Charles 10,000

What I've tried to do in the expression editor is:

Concat(County,'Montgomery' and 'Charles) as M&C

I am expecting 1 bar that says M&C with a measure of 18,000

1

There are 1 best solutions below

0
On

Usually these things are sorted in the load script. The main reason (for me) is that to solve these you'll have to use calculated dimension which will have performance implications. Especially when used on apps with larger datasets.

Another reason is that if the value is derived in the load script then you can use it anywhere in the app. But if calculated dimension is used then you'll have to write the same calculation in each chart where it is used. And this becomes quite tedious if change of the mapping is required.

From Qlik help page:

Calculated dimension warning

That being said ...

In order to create the mapping you have to edit the dimension itself:

Dimension

And add the following expression there:

=if(Country = 'Montgomery' or Country = 'Charles', 'M&C', Country)

And this will produce the following chart:

Result chart

For reference my data is:

RawData:
Load * Inline [
Country       , Population
Montgomery    , 8000
Charles       , 10000
Something else, 5000
];