Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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.
On the visual when sorted they show up in the order of ""01 2023 Name", "02 2023 Name", 11 2022 Name", "12 2022 Name", which is to be expected.
How I need it to sort is "11 2022 Name", "12 2022 Name", "01 2023 Name", "02 2023 Name", "03 2023 Name", "04 2023 Name" and so on. Any thoughts on how to go about this?
TIA
Can you share your file? Put it on dropbox or onedrive and share the link here.
I'll have to see if I can sanitize it.
You don't sort the table by the [test sort] column. You set the sort order for the column you are showing in the x axis using [test sort] column.
In the table view.
Select the column you are showing in the x axis.
Go to the 'Sort by column' drop down and pick the [test sort] column.
You are telling PowerBI 'Sort this column I have clicked on using the values in this other column I pick in the drop down'
Okay...did that. Still doesn't change the sort order on the visual
So you would need to add another column using the same source but change the output to be the numeric sort order for the field you already added. What is the DAX code for the created column you are trying to sort?
Sorry, I don't follow. Do you mean the table that has the field you are trying to add the sort to is a calcualted table? The code Text.Middle([Campaign Group],3,4) & Text.Start([Campaign Group],2)) will only work in PowerQuery, it will not work in DAX.
If you are working on a calculated table you could add the sorting field at the same time as you caclulate the rest of the table.
No. It's not a calcuated table. It's the original data table, but the column that I need to apply the formula to is not part of the original table, but was created by grouping together data from another column.
Hi @PowerBINoob24 ,
In DAX, you can create a new column named "DateIndex" as shown below :
Then select the Date column, click on "Sort by column" and select DateIndex.
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂
Hi @jdbuchanan71 ,
Thanks for pointing that out. I should have checked before posting. The Power query approach is the correct one.
Kind regards,
Rohit
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.
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".
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:
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
User | Count |
---|---|
86 | |
85 | |
68 | |
67 | |
63 |
User | Count |
---|---|
210 | |
118 | |
116 | |
81 | |
74 |