13 Replies Latest reply: Mar 14, 2018 8:42 PM by Sunny Talwar RSS

    Bar Chart Color by firstsortedvalue

    Dragos Simionescu

      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