Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trend line for a stacked bar chart

Hi!

I need some help with the syntax for an trend line expression in an stacked bar chart.

I have chosen a combo chart with stacked bars. My plan is to have one more expression with the trend line as a line chart but I don't seem to get the syntax right. (The usual trend line function doesn't seem to work when the bars are stacked.)

The bares shows stacked sales for segments per month and I want the trend line to show where the total sales trend is heading for the chosen periods.

BR

Zandra

7 Replies
Not applicable
Author

No suggestions?

boorgura
Specialist
Specialist

Hey Zandra,

Are you selecting the option to show both bars and line for the same expression.

if that doesn't work try copying the same expression. One showing bars and the other showing a trend.

pover
Luminary Alumni
Luminary Alumni

Zandra,

I can think of 2 options Both are dirty solutions, but maybe it's enough for what you need.

Option #1 is creating 2 graphs. One graph has the stacked bar chart and the other has the total linear tendency then you overlay one graph over the other with one graph being transparent and fixing the axes in both graphs so that they match. This is not my favorite option.

Option #2 is creating a expression for every segment and then an expression for the total amount that is invisible, but has the linear tendency activated. An image of Option #2 is attached. This is a decent option as long as you don't have a 1,000 segments.

Good luck, Pover

Not applicable
Author

Hi Pover!

I have tried your suggestion #2 but I don't get it to work...

The trendline is not visiable, not even if I uncheck the "Invisible" check box.

Are your bars Stacked? Are there any other settings I have to make? I have made sure that my expressions tab looks the same as yours.

Is there anything else I have to do?

BR

/Zandra

pover
Luminary Alumni
Luminary Alumni

Hi Zandra,

Here's the qvw with the graph. Hopefully that will help you find what's missing.

Not applicable
Author

Thanks a lot!

Now I know what my problem was.

I don't want to have the first expression lable as a header on the chart. I solved that by creating an empty expression with no label as the my expression. But that was the issue that caused my trend line not to show up.

I guess there must be a better way to hide the chart header, do you know how?

/Zandra

Not applicable
Author

I found the check box on the first tab.

Thanks!

/Zandra