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: 
Georgy_Paul
Contributor II
Contributor II

Front end Aggregation in Line chart

Hi. So I have a data with attributes, for example 

AttributeValue
A4
B5
C6
D7
E8
F9

 

I need to show a line chart with the values for each of these attribute and then A+B as G as well.

So basically in line chart I should be having all the attributes along with G = 9.

I can't do this in backend. Is there anyway to do this in expression in line chart.

Labels (2)
2 Replies
sergio0592
Specialist III
Specialist III

Hi,

You can achieve this in backend statement :

TAB1:
load *
INLINE [
Attribute,Value
A,4
B,5
C,6
D,7
E,8
F,9]
;


TAB2:
load
'G' as Attribute,
sum(Value) as Value
resident TAB1
where Attribute ='A' or Attribute= 'B';

 

P1.jpg

SerhanKaraer
Creator III
Creator III

Hello,

You can create a synthetic dimension with Valuelist based on existing data and adding non-existing data explicitly as below:

=ValueList($(=concat(chr(39) & Attribute & chr(39),',')),'G')

In the expression, you have to define formula for each field value as below:

pick(match(ValueList($(=concat(chr(39) & Attribute & chr(39),',')),'G'),$(=concat(chr(39) & Attribute & chr(39),',')),'G'),
$(=Concat(aggr('Sum({<Attribute={"'&Attribute&'"}>} Value)',Attribute),',')),
Sum({<Attribute={"A","B"}>} Value)
)

Downside of ValueList is that you can not select values and filter on this synthetic field as this field does not exist in the data model.

I hope this solves your problem.