Qlik Community

Qlik Sense App Development

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

dragossim101
New Contributor

Bar Chart Color by firstsortedvalue

Hi

I'm using the Adventureworks database and trying to set up the following bar chart:

Sales Amount by StateProvince Name, each bar colored by the top Occupation calculated as highest average Sales.

I expect to see a bar chart with each bar colored in one of the 5 colors corresponding to the 5 values in the Occupation dimension.

I was able to create an expression which brings me the top occupation using firstsortedvalue:

firstsortedvalue(EnglishOccupation,-Aggr ((sum($(vSalesUSD))/Count(CustomerKey)), EnglishOccupation, StateProvinceName))

However I can't make this same expresion work as a color differentiator in the Bar chart. What am I missing?

The expression works as expected in a simple table:

highest average sales ok2.PNG

1 Solution

Accepted Solutions

Re: Bar Chart Color by firstsortedvalue

Something like this?

Capture.PNG

13 Replies
dragossim101
New Contributor

Re: Bar Chart Color by firstsortedvalue

any ideas?

dragossim101
New Contributor

Re: Bar Chart Color by firstsortedvalue

Not giving up on this, any ideas if this can be achieved and how?

Thanks!

Re: Bar Chart Color by firstsortedvalue

What is the exact expression you are using for your color expression?

dragossim101
New Contributor

Re: Bar Chart Color by firstsortedvalue

That's the problem, I don't know how I should use the above expression, which brings me correct results, for the color by expression field. I tried using it as it is and I only get grey bars...

Thanks for looking into this

Re: Bar Chart Color by firstsortedvalue

Would you be able to share a sample?

dragossim101
New Contributor

Re: Bar Chart Color by firstsortedvalue

Here it is. The first sheet should be self explanatory. I want to have the first chart colored by the English occupation, as the data shows in the table in the lower right side.

Everything else seems to be working ok.

Re: Bar Chart Color by firstsortedvalue

Something like this?

Capture.PNG

dragossim101
New Contributor

Re: Bar Chart Color by firstsortedvalue

exactly

Re: Bar Chart Color by firstsortedvalue

I have attached the sample back with my last response for you to take a look at

Community Browser