Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a pivot table like the one below. I am graphing this as a bar chart where N, Y are the x-axis, % is the y-axis and each A% and B% pair are the bars. Is there a way to sort this on the x-axis based on the A% value. For instance, here YA% is 0 whereas NA% is 3. YA% would be to the left of NA% on the x-axis on the bar chart. The NB% and YB% values do not matter in this sort.
% | ||
N | A | 3 |
B | 1 | |
Y | A | 0 |
B | 10 |
I got the answer here: https://community.qlik.com/t5/QlikView-App-Development/Sort-Dimension-1-of-Multiple-Bar-Chart/m-p/17...
Thank you to everyone who helped.
Sorting a pivot table or bar chart can be done under the sort tab. You can sort it by the expression you are using.
Like
if you are looking for something like
Say I have a chart like this. How do I sort it only based on the Desired orange bar, where the orange bars go in descending order. The values of the bar I calculated using an expression that has references to the dimensions.
Sample data:
tab1:
LOAD 2006+IterNo()-1 As Year,
Ceil(Rand()*1000) As Desired,
Ceil(Rand()*1000) As Real
AutoGenerate 1
While IterNo()<=10;
Two ways you can do.
Dimension: Year
Expression: Desired and Real
Make Desired as your first Expression.
To clarify, the problem is that the desired and real values are both generated by the same expression. Please refer to my table on the original post.
Can you please explain how do you have two bars for each year but in the sample data you mentioned only one metric.
It would be easier if you can share your qvw.
The qvw file is attached with made up data. How would I sort the chart with b=1 going in descending order?
Unfortunately, I am not able to find a solution to this, for now, you use your expression in sort tab under b
This will work when one year (a) is selected. I tried searching the community for this and couldn't find much useful solutions.
https://community.qlik.com/t5/New-to-QlikView/2-Dimension-Bar-Chart-Sorting/m-p/966667
With the 3rd option, you will be able to create a chart similar to
Thank you for the effort. I think my problem is misunderstood. I want the sort the chart by rearranging the values on the x axis. So in the test.qvw I linked earlier, you see that each 'year' (a) is associated with odd numbers from 1 to 9 (b)(excluding 11). How do I sort the year (a) so that the associated 1 values (from b) are going in descending order. So in the test.qvw dashboard I have, it would be sorted like 2018, 2015, 2017, 2016 in this order. Looking at the blue bars associated with the value 1 (from b), they go in descending order from left to right. The odd numbers from 1 to 9 (from b) though, should be kept in ascending order.