Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have various measurements with a flag "high is good" and country as a dimension.
When presenting them in a bar chart, I want them to sort from "bad to good", meaning the worst are left and the better ones are to the right and potentially I have to scoll to see them.
As mentioned before, with the flag "high is good" altering, some need to be sorted ascending and some descending.
How can I make this depending on the flag?
Hope this was well explained.
Keep Qliking
Michael
Hi Michael,
I have done such interactive sorting with a sort-expression like:
YourChartExpression - $(vSortDirection)
where vSortDirection contained either 0 or a very high value like 10000000000 which will be reverse the sorting. You could set the variable with a inputbox or a button and as alternatively you could also use a field-selection maybe from a small inline table like:
SortDirection:
Load * Inline [
Direction, SortValue
Ascending, 0
Descending, 1000000000
];
and your sort-expression could be:
YourChartExpression - SortValue
- Marcus
in sort tab...
Expression:
=Match(FieldName,' A','b','c') lik so on
or u wan load order ascending or desc chk that
Go to Bar chart properties-> Sort Tab-> Sort it by expression ascending or descending
or sort it by Y-Value
Check this great blog: Perfectly Sorting Pivot Table (by A-Z. y-Value set for each dim-level) by cschwarz
Hi Michael
U can use the Match Function, it returns a 1 if a value in the list you specify is found and 0 if the value was not found
=Match(flag, 'high is good') will return 1 for all the rows that contains 'high is good' and they will be first if you sort by expression showed in Chanty's post
You can have a number generated in the script itself to sort it.
Hi Michael,
I have done such interactive sorting with a sort-expression like:
YourChartExpression - $(vSortDirection)
where vSortDirection contained either 0 or a very high value like 10000000000 which will be reverse the sorting. You could set the variable with a inputbox or a button and as alternatively you could also use a field-selection maybe from a small inline table like:
SortDirection:
Load * Inline [
Direction, SortValue
Ascending, 0
Descending, 1000000000
];
and your sort-expression could be:
YourChartExpression - SortValue
- Marcus
Hi Markus,
just the right hint, but i do it even more simple now:
The wayto revert the sorting order is to multiply the expression value with (-1).
As my flag "High is good" unfortunately is (0,1), I use the sorting Expression
= (2*flag_High_Is_Good -1) //this is -1 for high is good=0
* MyExpression
That works perfectly. Does it make sense this way?
If someone want to add a user interaction capability to change the sorting in a chart, then a button to toggle a variable (-1,1) would be appropriate as well, of course.
Thanks a lot for all contributions.
Keep Qliking
Michael
Hi Michael,
it's a great solution - I like it.
- Marcus