11 Replies Latest reply: Oct 13, 2017 6:31 PM by Marco Wedel

# stacked chart

i have a stacked chart with dimension as product and year ,expression as sum(sales)  i have selected two years(2010,2011) and it will shows in stacked chart but i want to show difference in sales (2010,2011) in line graph. that means its a combination of stacked and line chart how to do it

• ###### Re: stacked chart

Use a combo chart.

• ###### Re: stacked chart

i need a expression for line chart  i made selections on years it will show in bar chart but in line chart need to show the difference of these two years

• ###### Re: stacked chart

Can you share a sample to look into and your expected output please?

You can group expressions to show the Years.

• ###### Re: stacked chart

load * inline [Sales, Category, Year

100,furniture,2014

220,furniture,2015

330,furniture,2016

33,furniture,2017

100,powder,2014

220,powder,2015

330,powder,2016

33,powder,2017];

example data here, in line graph i have selected 2014 and 2016 manually but if made selections year that will change dynamically and shows difference in line graph

• ###### Re: stacked chart

So you mean you want to show that line graph with sales 2016 - 2014 to be static even though you do any selections in Year field?

• ###### Re: stacked chart

no if i select 2013 ,2014  line graph need to show difference between those two years ,if i select 2014,2015 it will show for those year what ever i select for those years its need to reflect ,but line graph need to show =lowest year - highest year sales on current selections

• ###### Re: stacked chart

Create two variables like below in your Variable overview and then use the expression below tin your line graph.

Ctrl+Alt+V variable overview and add two variables vMaxYear and vMinYear. Then use the two expressions

vMaxYear  =Max(Aggr(Concat(DISTINCT Year, ','), Year))

vMinYar     =Min(Aggr(Concat(DISTINCT Year, ','), Year))

For your line graph use below expr:

=Sum({< Year = {'\$(vMinYear)'} >} Sales) - Sum({< Year = {'\$(vMaxYear)'} >} Sales)

• ###### Re: stacked chart

Did it not resolve what you are looking for?

• ###### Re: stacked chart

i want to limit the multiple selections in year list box because i want to show the difference between two years so i want to limit for 2 years ...bar graph shows the sum (sales ) and line graph shows the difference of those two years

• ###### Re: stacked chart

Hi,

one possible solution:

```tabSales:
Sales, Category, Year
100, furniture, 2014
220, furniture, 2015
330, furniture, 2016
33, furniture, 2017
50, powder, 2014
270, powder, 2015
180, powder, 2016
90, powder, 2017
];
```

hope this helps

regards

Marco