Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
Showing results for 
Search instead for 
Did you mean: 
Creator III
Creator III

How to highlight a single bar based on FirstSortedValue?


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

May be you can try this

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


Or your way would be this

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