Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
sunny_talwar

Something like this?

Capture.PNG

View solution in original post

13 Replies
Anonymous
Not applicable
Author

any ideas?

Anonymous
Not applicable
Author

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

Thanks!

sunny_talwar

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

Anonymous
Not applicable
Author

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

sunny_talwar

Would you be able to share a sample?

Anonymous
Not applicable
Author

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.

sunny_talwar

Something like this?

Capture.PNG

Anonymous
Not applicable
Author

exactly

sunny_talwar

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