Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I have a Stacked Bar chart like below.
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?
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())
now if i add the logic for max:
the max became red:
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())
now if i add the logic for max:
the max became red:
Thanks @edwin