Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Color Coding within Hierarchy Dimension Based on Value

 

Hi,

I have a category dimension with 2 levels. I'm working on a stacked bar chart with both levels as dimension and Sum(Amount) as value. I want to color code the bar in a way that the largest level 2 category with in the level 1 category they belong to get the darkest color, and the 2nd, 3rd largest etc has the same color.  This way each level 1 category will have a largest level 2 category with the same color within the bar. (ie, 1245,463,356 should have the same color). I don't want only the largest level 2 category among all level 2 to have the darkest color.

Is there a way to do using expression in the chart instead of scripting?

Thanks

Yvonne

Sample Data:

Category Level 1Category Level 2Amount
FruitApple356
FruitApple35
FruitBanana245
FruitBanana54
FruitStrawberry463
VegetableCucumber543
Vegetable
Broccoli
35
Vegetable
Broccoli
234
VegetablePotato423
VegetableCarrots1245
DrinkBeer356
DrinkSoda67
1 Solution

Accepted Solutions
sunny_talwar

May be using this expression:

=If(Rank(Sum(Amount)) = 1, RGB(0, 187, 237), ARGB(150, 0, 187, 237))


Capture.PNG

View solution in original post

1 Reply
sunny_talwar

May be using this expression:

=If(Rank(Sum(Amount)) = 1, RGB(0, 187, 237), ARGB(150, 0, 187, 237))


Capture.PNG