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: 
Not applicable

Club and Display two dimension values into one

Hi all, I have a table containing multiple columns and I am displaying a graph based on two columns, Attributes and Values. There are five attributes (A , B, C, D and E ) and I am showing a simple bar graph of values for each of them. I have set Attributes as dimension and sum(value) as expression. My requirement is to not display all attributes separately as five bars but instead A and B clubbed into one bar called AB, C will remain as such and finally D and E combined into a bar called DE. Just three bars as final. I tried creating calculated dimensions but I am unable to, Can someone help me here?

1 Solution

Accepted Solutions
Vegar
MVP
MVP

O I forgot to mention that you should remove the Attribute as a dimension. You are "replacing" the dimension with multiple expressions.

View solution in original post

7 Replies
Vegar
MVP
MVP

A fast solution to your problem is to define one expression per calculation requirement in your chart.

SUM({$<Attribute = {'A','B'}>}Value)

SUM({$<Attribute = {'C'}>}Value)

SUM({$<Attribute = {'D','E'}>}Value)

Vegar Lie Arntsen

Not applicable
Author

I tried this Let's say I just add the first expression, I still get two bars. I need just one bar having the sum of both..

jochem_zw
Partner Ambassador
Partner Ambassador

At properties, style, subtype choose stacked bars.

Vegar
MVP
MVP

O I forgot to mention that you should remove the Attribute as a dimension. You are "replacing" the dimension with multiple expressions.

Not applicable
Author

Thanks this works but is there a better solution? I just provided a sample question and in the real application the graph as two more expressions depending on the same dimension.

Is there a way I can create dimensions for clubbing?

Vegar
MVP
MVP

I would have created a new dimension in my script where I assign my transactions to my dimensions. There are several ways to do it, but the most fool proof is to use a mapping table.

My_map:

MAPPING LOAD * INLINE [

OrigDim, NewDim

A, AB

B, AB

C, C

D, DE

E, DE

]

Trans:

LOAD

     *,

     ApplyMap('My_map', OrigDim, null() ) as NewDimension

FROM ... ;

//Vegar

Not applicable
Author

Thank you Vegar, I will explore this solution.