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

Qlikview: Color coding a single bar chart with multiple expressions

Hi,

I have a barchart that has two expressions "Number of Sales" and "Average Sales Amount"

I want to color code only the "Average Sales Amount" bar by the Gender Dimension. The chart should look similar to below.

Gender_Color_Coding.PNG

I am attaching my sample qvw.

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

With some playing around, I actually got it looking like you suggested

BarStackedandNot.png

Se also attached

View solution in original post

6 Replies
Anil_Babu_Samineni

Not sure - i understand the request for below one

I want to color code only the "Average Sales Amount" bar by the Gender Dimension.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sqlpuzzle
Contributor III
Contributor III
Author

There is a Gender Dimension, I want to add it to the Chart and make only the Average Sales Amount bar get colored by the gender dimension. Similar to below. Only the bar for "Average Sales Amount" should be affected the "Number of Sales" bar should not be affected.

AVG_Sales_By_gender.PNG

stigchel
Partner - Master
Partner - Master

It think this is the closest you can get to what you want, or you should stack all bars.

Split the Average Sales Amount expression into the two gender values e.g.

= AVG({<Gender={'M'}>}SalesAmount)

and use an offset for the second gender expression

BarOffset.png

Also see attached

stigchel
Partner - Master
Partner - Master

With some playing around, I actually got it looking like you suggested

BarStackedandNot.png

Se also attached

sqlpuzzle
Contributor III
Contributor III
Author

This works even though I am struggling to understand the solution.

stigchel
Partner - Master
Partner - Master

Instead of a Gender dimension that would split the Number of Sales expression as well and would display Gender=M or F in the mouse over, I used a synthetic dimension ValueList with two values. I've hided the legend for this dimension, so it does not display in the x axis. It does in the mouse over, but with a rather anonymous group=1 or 2 (you could alter the label to 'Bar', so it would display Bar =1 or 2).

All the expressions only result in a value for one of the two values from the synthetic dimension, 0 and Null values are not displayed in the chart. The Number of sales expression has a value for Group 1 (or Bar 1 as you will) and the two Average Sales Amount expressions (split by gender) have a value for Group=2.