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

How to highlight a single bar based on FirstSortedValue?

Hi,

I have a bar chart that shows the sales by Country.

What I would like to do is show the highest sales country in a different colour.

So for example show the country with biggest sales in Green, and everything else in Blue.

How can I achieve this?

Dimension is Country

Measure is Sum(Sales)

I thought to get the biggest sales country name value by doing FirstSortedValue(Country, -Aggr(Sum(Sales), Country)

And then use it in an IF statement for Colour By Expression. E.g. If(Country = <OutcomeOfFirstSortedValueExpresison>, Green, Blue)

But it does not work.

2 Replies
sunny_talwar

May be you can try this

If(Sum(Sales) = Max(TOTAL Aggr(Sum(Sales), Country)), Green(), Blue())

sunny_talwar

Or your way would be this

If(Country = FirstSortedValue(TOTAL Country, -Aggr(Sum(Sales), Country), Green, Blue)