Trouble stacking multiple bars

I have these bars with the query within the picture.

I want to stack the bars, grouped by area but stack on each other volume from one week and volume from other week, sales from one week and sales from other week but I get this:

Is there a way to accomplish this? Table below:

Please provide your sample data as csv as follows

id,report_date,area,team,volumne
3,2022-04-18,area1,B,26

or basic DDL and DML

create table areas(id nt, report_date datetime, 
area varchar(50), team, char(1), volume int)

insert into areas
values(3,'2022-04-18','area1','B',26)

This will help us help you. Hard to work with an image data

Hi yosiasz, unfortunately I cannot attach a CSV file to my post. Here is the data:
[β€˜id’, β€˜report_date’, β€˜area’, β€˜team’, β€˜volume’, β€˜sales’]
[β€˜1’, β€˜2022-04-17 19:00:00’, β€˜area1’, β€˜A’, β€˜33’, β€˜69’]
[β€˜2’, β€˜2022-04-17 19:00:00’, β€˜area1’, β€˜A’, β€˜3’, β€˜45’]
[β€˜3’, β€˜2022-04-17 19:00:00’, β€˜area1’, β€˜B’, β€˜26’, β€˜74’]
[β€˜4’, β€˜2022-04-17 19:00:00’, β€˜area1’, β€˜B’, β€˜44’, β€˜59’]
[β€˜5’, β€˜2022-04-17 19:00:00’, β€˜area1’, β€˜B’, β€˜90’, β€˜94’]
[β€˜6’, β€˜2022-04-17 19:00:00’, β€˜area1’, β€˜C’, β€˜123’, β€˜88’]
[β€˜7’, β€˜2022-04-17 19:00:00’, β€˜area1’, β€˜C’, β€˜12’, β€˜4’]
[β€˜8’, β€˜2022-04-17 19:00:00’, β€˜area2’, β€˜A’, β€˜134’, β€˜77’]
[β€˜9’, β€˜2022-04-17 19:00:00’, β€˜area2’, β€˜A’, β€˜2’, β€˜91’]
[β€˜10’, β€˜2022-04-17 19:00:00’, β€˜area2’, β€˜B’, β€˜252’, β€˜93’]
[β€˜11’, β€˜2022-04-17 19:00:00’, β€˜area2’, β€˜C’, β€˜67’, β€˜22’]
[β€˜12’, β€˜2022-04-17 19:00:00’, β€˜area2’, β€˜C’, β€˜65’, β€˜68’]
[β€˜13’, β€˜2022-04-24 19:00:00’, β€˜area1’, β€˜A’, β€˜77’, β€˜88’]
[β€˜14’, β€˜2022-04-24 19:00:00’, β€˜area1’, β€˜A’, β€˜33’, β€˜26’]
[β€˜15’, β€˜2022-04-24 19:00:00’, β€˜area1’, β€˜B’, β€˜87’, β€˜8’]
[β€˜16’, β€˜2022-04-24 19:00:00’, β€˜area1’, β€˜B’, β€˜3’, β€˜67’]
[β€˜17’, β€˜2022-04-24 19:00:00’, β€˜area1’, β€˜C’, β€˜8’, β€˜89’]
[β€˜18’, β€˜2022-04-24 19:00:00’, β€˜area1’, β€˜C’, β€˜57’, β€˜41’]
[β€˜19’, β€˜2022-04-24 19:00:00’, β€˜area2’, β€˜A’, β€˜65’, β€˜19’]
[β€˜20’, β€˜2022-04-24 19:00:00’, β€˜area2’, β€˜A’, β€˜41’, β€˜12’]
[β€˜21’, β€˜2022-04-24 19:00:00’, β€˜area2’, β€˜B’, β€˜87’, β€˜46’]
[β€˜22’, β€˜2022-04-24 19:00:00’, β€˜area2’, β€˜C’, β€˜55’, β€˜90’]

table creation
CREATE TABLE test (
id serial primary key
report_date timestamp not null
area varchar not null
team varchar not null
volume int not null
sales int not null)

1 Like

like this? add group by report_date

That is close, I would have liked area1 volume and sales to be grouped with each other as well

could you sketch it up in paint and post back ?

Something close to this would be perfect

I think the closest you can with that is by adding

order by area

Also the 0 are overlapped on top of those stacked charts, could it be a bug?

No, I used paint to create the picture I would like, thank you for your help. I don’t think I will be able to get it exactly how I would like.

1 Like