Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Karthick30
Creator
Creator

Unique Color for Maximum value in Stacked Bar chart

Hi ,

I have a Stacked Bar chart like below.

Karthick30_0-1655909968842.png

for past 3 years , each month value has been taken here. Now I have the Requirement to show max values in separate colour for each month.

For Ex.. Apr , 34176 is the Max value out of remaining 2 years value. So i need to color that alone in unique colour.

Likewise , each month max value for one particular year has to be in same unique color. Any logic to achieve that?

Labels (2)
1 Solution

Accepted Solutions
edwin
Master II
Master II

there are two components to your problem:
1. find the max per year
2. set the color

to get the max:
aggr(nodistinct max(aggr(nodistinct sum(Measure), Month, Year)), Month)

to set the color:
in yor chart, set color to expression:
if(sum(Measure)=aggr(nodistinct max(aggr(nodistinct sum(Measure), Month, Year)), Month),red(),
here your expression for the color by year
)

here is a sample run.  this one.  the first doe snot look at max and the colors are:
pick(match(ThisYear,2019,2020,2021,2022),blue(), green(), Yellow(), Black())

edwin_0-1655913569488.png

now if i add the logic for max:
the max became red:

edwin_1-1655913638030.png

 

 

View solution in original post

2 Replies
edwin
Master II
Master II

there are two components to your problem:
1. find the max per year
2. set the color

to get the max:
aggr(nodistinct max(aggr(nodistinct sum(Measure), Month, Year)), Month)

to set the color:
in yor chart, set color to expression:
if(sum(Measure)=aggr(nodistinct max(aggr(nodistinct sum(Measure), Month, Year)), Month),red(),
here your expression for the color by year
)

here is a sample run.  this one.  the first doe snot look at max and the colors are:
pick(match(ThisYear,2019,2020,2021,2022),blue(), green(), Yellow(), Black())

edwin_0-1655913569488.png

now if i add the logic for max:
the max became red:

edwin_1-1655913638030.png

 

 

Karthick30
Creator
Creator
Author

Thanks @edwin