Forum Discussion
How can I sort the text values in a filter object?
- Anonymous10 years ago
Hi Anonymous,
as meysun said you have to use "Sort By Column".
1) You have to create two calculated columns ("monthName" and "monthNumber") and visualize monthName as a filter.
2) After that you have to select "Sort By Column" and sort by monthNumber, and you gain the result.
Let Me Know If It Works.
#I'M Not An Expert#
I see that you are trying to sort months chronolically.
If the user entered the months, Power BI will consider them as text and will not convert them to dates even if you tried to in the formatting section, it won't let you.
I found a 'not very nice' workaround to that...
Consider that the months you want to sort are in a column named 'Text'. Add a new column: Month = Table1[Text]&"-16"
This new column will automatically take the data type date.
Add the new column 'Month' to an empty table, you will have the following values in the visualizations pane
Remove year, quarter, and day. Only the month will stay and it will be considered as a date, that way you can sort it according to time and not alphabetically.
Then you can transform your table into a slicer and months will stay ordered.
I tried to extract the month directly from the new column but that didn't work.
If someone has a better and neater solution, please let us know.
Best!