Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
cheryl
Contributor III
Contributor III

Two dimensions in one bar chart on x-axis

Hi,

I'm trying to create a bar chart with two dimensions on the same x-axis.

Here's  an example to illustrate, I have a dimension: Clothes-type (including Shirt, pants, Skirt, Shoes and Scarf), and a measure Sales.

I have another dimension: Color of these clothes. Specifically, I want to see the Sales of these clothes which are red, and I want to put it together with Sales by Clothes-type in the same bar chart.

The desired bar chart is shown below.

Do you have any idea how to achieve this preferably in the chart expression (instead of script)?

Thanks in advance!

 Sales
Shirt2
Pants5
Skirt3
Shoes4
Scarf1
Red7

 

cheryl_1-1633111405801.png

Labels (1)
1 Solution

Accepted Solutions
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Something like below ?

 

Table:
Load * Inline [
Clothes, Color, Sales
Shirt,Red,10
Shirt,Yellow,20
Shirt,Black,10
Pants,Red,25
Pants,Blue,40
Shoes,Red,30
];

Concatenate
RedClothes:
Load
Sales,Color,
Color as Clothes
Resident Table Where Color = 'Red';

AshutoshBhumkar_0-1633335421495.png

 

View solution in original post

3 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

How do you define which cloths are red ?

E.g

If you have data like below, you can use stacked bar chart to identify Sales of Red cloths.

Table:
Load * Inline [
Clothes, Color, Sales
Shirt,Red,10
Shirt,Yellow,20
Shirt,Black,10
Pants,Red,25
Pants,Blue,40
Shoes,Red,30

];

Output :

AshutoshBhumkar_0-1633175598558.png

 

Or you can share sample data with column 'Color of clothes'.

 

Thanks,

Ashutosh

cheryl
Contributor III
Contributor III
Author

Hi Ashutosh,

Thank you for your reply.

Indeed I have data like that.

However, Is there possibility to have 'Red' as a bar itself instead of stacked bar? (Just as what I showed in my post).

This is because we are only interested in seeing the sum of 'Red' clothes. 

 

Best Regards,

Cheryl

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Something like below ?

 

Table:
Load * Inline [
Clothes, Color, Sales
Shirt,Red,10
Shirt,Yellow,20
Shirt,Black,10
Pants,Red,25
Pants,Blue,40
Shoes,Red,30
];

Concatenate
RedClothes:
Load
Sales,Color,
Color as Clothes
Resident Table Where Color = 'Red';

AshutoshBhumkar_0-1633335421495.png