Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ingo_lsg
Contributor III
Contributor III

How to merge two values of one dimension via chart function

Hi experts,

I have one dimension with e.g three values

A,

B,

C,

Now I want to merge A and B in the chart (not via applymap in the script) to aggregrate their KPI value. I have to create a calculated dimension for this, right?. But my attempts all failed.

Any suggestions?

BR Ingo

Labels (3)
1 Solution

Accepted Solutions
Kushal_Chawda

Option 1 : Recommended

Dim:
Load * Inline [
List
1
2 ];

Data:
Load * Inline [
Dim, Value
A, 10
B, 15
C, 30];

Dimension:
=pick(List,'A-B',Dim)

Expression:
=pick(List,sum({<Dim={'A','B'}>}Value),sum({<Dim-={'A','B'}>}Value))

 

Option 2: Without script

Data:
Load * Inline [
Dim, Value
A, 10
B, 15
C, 30];

Dimension:
=aggr(if(match(Dim,'A','B'),'A-B',only({<Dim-={'A','B'}>}Dim)),Dim)

Expression:
=if(not match(Dim,'A','B'),sum({<Dim-={'A','B'}>}Value),sum({<Dim={'A','B'}>}Value))

 

View solution in original post

5 Replies
NitinK7
Specialist
Specialist

Hi,

Not understood your question

can you explain using some examples

ingo_lsg
Contributor III
Contributor III
Author

Hi,

my data looks like this:

Dim, Value

A, 10

B, 20

C, 30

Now it should look like:

Dim, Value

A (represents A and B), 30 (A+B)

C, 30

Does this help?

BR

Ingo

ingo_lsg
Contributor III
Contributor III
Author

Hi guys,

 

come on!

Nobody could help?

BR

Ingo

Kushal_Chawda

Option 1 : Recommended

Dim:
Load * Inline [
List
1
2 ];

Data:
Load * Inline [
Dim, Value
A, 10
B, 15
C, 30];

Dimension:
=pick(List,'A-B',Dim)

Expression:
=pick(List,sum({<Dim={'A','B'}>}Value),sum({<Dim-={'A','B'}>}Value))

 

Option 2: Without script

Data:
Load * Inline [
Dim, Value
A, 10
B, 15
C, 30];

Dimension:
=aggr(if(match(Dim,'A','B'),'A-B',only({<Dim-={'A','B'}>}Dim)),Dim)

Expression:
=if(not match(Dim,'A','B'),sum({<Dim-={'A','B'}>}Value),sum({<Dim={'A','B'}>}Value))

 

ingo_lsg
Contributor III
Contributor III
Author

Many thanks!