Forum Discussion
Sorting visual by a "date" that is text based.
You need a field that has the sort order in numeric format. You can add one in PowerQuery by adding a custom column that gets the portion of the field you need to use for the sort.
Text.Middle([Text Field],3,4) & Text.Start([Text Field],2)
Then change the data type of the new column to whole number.
Then, in the table view change the sort by of the text field to use the new column.
- PowerBINoob243 years ago
Resolver I
Well that would work, but I just realized that the Name field is a column created in a table that is a group, so when I go into power query it's not available as a column in the source spreadsheet if that makes sense. I've tried this:
Campaign Sort = Text.Middle([Campaign Group],3,4) & Text.Start([Campaign Group],2)) but that throws the following error:The syntax for '.' is incorrect. (DAX(Text.Middle([Campaign Group],3,4) & Text.Start([Campaign Group],2)))). - PowerBINoob243 years ago
Resolver I
Okay. So I managed to make some changes so I could implement what you suggested above. Added a text sort column through Power query, went into the table view and the sorted by the test sort column. It sorts as you stated it would in the table, but that doesn't impact the visual because the visual still sorts the x axis by the "01 2023 Name", "02 2023 Name", 11 2022 Name", "12 2022 Name".