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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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
MVP
MVP

May be you can try this

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

sunny_talwar
MVP
MVP

Or your way would be this

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