4 Replies Latest reply: Aug 28, 2017 12:23 AM by Divya anand

# Sort a bar chart based on 2 fields not already in the chart

Hi all,

I am trying to sort a bar chart based on 2 fields - Week & Field. As you can see in the table below, it is sorted based on the fields Week & Field, of course I could achieve this because I included the two fields in the table (as expressions) and sorted. Here's my question - Is it possible to sort the bar chart just like in the table?

I've attached a sample qvw.

• ###### Re: Sort a bar chart based on 2 fields not already in the chart

Hi Clever Anjos,

Thank you for the response.

This actually sorts based on the expression and not based on Week & Field.

If I changed the value of (Product=C, Week=4, Field=10) from 999 to 910, then the sorting changes in the chart

But you see that the sorting in the table remains the same because the table has been sorted based on Week & Field, which I am looking for.

Any thoughts?

• ###### Re: Sort a bar chart based on 2 fields not already in the chart

Sort using this

=FirstSortedValue(Week*1000 + Field, -Aggr(Sum(value), Product, Week, Field))

• ###### Re: Sort a bar chart based on 2 fields not already in the chart

Hi Sunny,

This works. Thank you.