Forum Discussion
Using a Categorical Variable Parameter on Axis and Sort Reverting to Default.
Unfortunately, I prefer the look of the column charts and the real measure is a complicated % of total that already makes use of ALLEXCEPT and I haven't been able to get one that doesn't react to the filter in question that also calculates correctly.
Thanks for the reply from parry2k , please allow me to provide another insight:
Hi, hjolley
Your approach to sorting the columns is correct, but you need to sort each column selected by your parameter. For example:
Here is my sample data:
1.I have sorted each column based on the index column:
2.Here is the final result, which I hope meets your requirements:
Please note that the columns being sorted must not contain duplicate values, as this will result in a sorting error.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- hjolley1 year agoRegular Visitor
All the categorical columns have duplicate values. I am plotting a metric against a changing categorical variable so all the values are a creation of many, many rows.
I'm not entirely sure why your PowerBI graphs don't have a default sort axis but the problem is that whatever I do it defaults back to the numeric metric like so:
Vs yours, which does not in fact have a default sort at all:
- Anonymous1 year agoNot applicable
Hi, hjolley
Thank you for your swift response.
I apologise for any confusion caused. Your sorting method differs from mine. I use the position shown in the image below:
If your sorting column contains duplicates, the corresponding index values for those rows must also be duplicated:
I recommend using my method for sorting, as it can more effectively resolve your issue.
Of course, if you have any new ideas, you are welcome to contact us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- hjolley1 year agoRegular Visitor
I have no concerns with the sort order of the categorical variable when I can get the graph to sort by the categorical variable. The problem is that my graphs for some reason will not stay sorted by the character variable.
I don't know why your graphs don't have a default sort axis (maybe because the data is already summarized?) but I believe that is the core of the problem, not what the categorical variables are sorted by (currently, they are sorted by themselves).
I don't care if the data remains in data source order; I care that two graphs sort the same way, whatever that is.