Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rasmusnielsen
Partner - Creator
Partner - Creator

Order of legend items in stacked bar chart

Hi all,

I am having a problem with the order of the items in my legend in a stacked bar chart. My model looks like:

Model
date
brand
subbrand
product
discountDiff

My app looks like:

Screen Shot 2018-10-02 at 18.48.46.png

The first dimension is brand and the second dimension "discountDiff" is defined as:

Class(Aggr(Avg(discountDiff), brand, subbrand, product), 1)

The measure is defined as:

Count(distinct subbrand)

which creates all the buckets that I expect to see. But when I choose a product in my filter, the order of items in the legend is not correct:

Screen Shot 2018-10-02 at 18.48.56.png

I know that it has something to do with the main dimension "brand" that is somehow evaluated before the discountDiff classes is calculated.

I have also read in another discussion that the sorting is based on the measure number behind each bucket, which in this case is the number of sub brands represented by the discountDiff class.

I have tried manipulating the sort order of the discountDiff dimension with a set expression, but I have not managed to get it to work.

Any good advice?

Thanks

0 Replies