Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

divya_anand
Contributor II

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.

Tags (2)
1 Solution

Accepted Solutions

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))

4 Replies
Employee
Employee

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

Capturar.PNG

divya_anand
Contributor II

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))

divya_anand
Contributor II

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

Hi Sunny,

This works. Thank you.

Community Browser