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

13 Replies
Anonymous
Not applicable
Author

Thanks, this does work, I actually thought about doing this but was hoping of some way which doesn't involve a list of fixed values.

The way I imagined this, without going in much depth about the actual logic, was that the result of the expression will be interpreted as a dynamic dimension, each of its values being dynamically assigned a color.

Am I that far off?

I will mark the answer as correct, even though my expectations were a bit different.

sunny_talwar

I am not sure if there is another way or not, but may be omarbensalem‌ or youssefbelloum‌ might have ideas here

YoussefBelloum
Champion
Champion

Thanks for tagging me Sunny.


Unfortunately now I am not able to add anything..it is beyond me. as soon as I find something interesting I will share it with you

sunny_talwar

No problem at all... I just thought that since this is Qlik Sense question, you might have a better idea of its inbuilt functionality.... May be Omar can offer any advice still