Forum Discussion
PowerBINoob24
Resolver I
3 years agoSorting visual by a "date" that is text based.
Hi all, I have a line graph visual that shows data by month/year; however, the the data is a text field and the data is "11 2022 Name", "12 2022 Name", "01 2023 Name", "02 2023 Name", and so on. ...
jdbuchanan71
Super User
3 years agoYou 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.
PowerBINoob24
Resolver I
3 years agoWell 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)))).