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: 
zagzebski
Creator
Creator

Stack bar using a dimension

I have the following data and want to create a stack bar chart:

What I want is for the X-axis to be the month, the expressions (2013 Sales Per Member and 2012 Sales Per Member) to the be the bars side by side for each month. Then I want the other dimension (line of Business) to be stacked for each expression. Can't see what I am doing different from a few of the examples I looked at on this site - but I can't figure how to stack them.

Incurred MonthLine of Business2013 Sales Per Member2012 Sales Per Member
296.76316.61
AprElectronics2.192.51
JanElectronics2.762.53
MarElectronics2.943.45
FebElectronics3.453.15
FebFurniture9.9212.13
MarFurniture10.0912.65
AprFurniture10.5912.41
JanFurniture12.7712.31
FebKitchen57.4863.01
MarKitchen59.0167.60
AprKitchen60.8858.68
JanKitchen64.6966.18
5 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

You are trying to make a chart that is both grouped and stacked - the two expressions side by side require a grouped chart, while the Line of Business require a stacked chart. This is not something you can implement in QlikView.

Even if it was possible, the visual effect would be really hard to process - you'd need to follow monthly trend, through comparing year by year and divided by Line of Business... Too complex...

You'll need to reduce the complexity by one dimension - either show a stacked chart of monthly trends by Line of Business, or show a grouped chart of Monthly Trends comparing Year over Year, but without the distribution by Line of Business.

best,

Oleg Troyansky

zagzebski
Creator
Creator
Author

Thanks!

Not applicable

You can convert the field name of the sales fields into a dimension, using Crosstable

Crosstable(Year, Sales, 2)

LOAD * INLINE [

    Incurred Month, Line of Business, 2013 Sales Per Member, 2012 Sales Per Member

    Apr, Electronics, 2.19, 2.51

    Jan, Electronics, 2.76, 2.53

    Mar, Electronics, 2.94, 3.45

    Feb, Electronics, 3.45, 3.15

    Feb, Furniture, 9.92, 12.13

    Mar, Furniture, 10.09, 12.65

    Apr, Furniture, 10.59, 12.41

    Jan, Furniture, 12.77, 12.31

    Feb, Kitchen, 57.48, 63.01

    Mar, Kitchen, 59.01, 67.60

    Apr, Kitchen, 60.88, 58.68

    Jan, Kitchen, 64.69, 66.18

];

Thus will result a table containing Month, Line of  Business, Year and Sales.

Afterwards you can create a bar chart, having month and LoB as dimensions, sum(sales) as expression, and, of course, Stacked option selected within the Chart's Properties >> Style.

Cos

zagzebski
Creator
Creator
Author

I am not familiar with the crosstable function. So this would need to be utilized in the  script?

Not applicable

Yes. Crosstable is a transformation method used in the script in order to transpose your data