Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Relative Problem in a stacked bar chart

Hi guys,

I have a bar that has 2 dimensions. One for the month of the year and the other dimension to show a location.

My aim is to show values for each area relative to each other on a monthly basis.

Example:

I have one simple expression which is Sum(value)

Jun 2010 - I want a stacked bar chart that will show all the values relative to each other i.e 40%, 20%, 40%

Jul 2010 - I want another stacked bar showing values relative to each other i.e 35%, 30%, 30% and so on for other months.

I have the relative box ticked, but it calculating the value for every month reltaive to each other as opposed to calculating each individual month relatively.

Is there a way to get around doing this and getting the relative thing to work as expected?

Thank you

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

I believe you want to the bars to sum 100% every month, right?

The relative box will present the share of the value in the whole chart. If you have multiple locations and multiple months, the sum of all of them will be 100%.

You should uncheck the relative box and write the following expression:

sum (value) / sum ( total <month> value)

// you need to replace month by the dimension you are using as your time reference.

Hope this helps,

Erich

View solution in original post

2 Replies
erichshiino
Partner - Master
Partner - Master

I believe you want to the bars to sum 100% every month, right?

The relative box will present the share of the value in the whole chart. If you have multiple locations and multiple months, the sum of all of them will be 100%.

You should uncheck the relative box and write the following expression:

sum (value) / sum ( total <month> value)

// you need to replace month by the dimension you are using as your time reference.

Hope this helps,

Erich

Not applicable
Author

Fantastic Erich.

It worked perfectly. Thanks