Forum Discussion
Sorting order in legend
Hi Bakhtawar ,
I hope you have a calendar table ( date table) .
Using Edit Query create a new blank query and paste the following query
let
Source = CalendarTable,
#"Removed Columns" = Table.RemoveColumns(Source,{"X-AxisName", "SortOrder", "DateKey", "CalendarMonth", "CalMonthName", "CalMonthYearName", "IsCurrentCalYear", "MonthSeqNumber", "IsCurrentMonth", "StartPeriod", "EndPeriod"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"CalendarYear"}, {{"Count", each _, type table [CalendarYear=number]}}),
#"Removed Columns1" = Table.RemoveColumns(#"Grouped Rows",{"Count"}),
#"Added Index" = Table.AddIndexColumn(#"Removed Columns1", "Index", 1, 1),
#"Changed Type" = Table.TransformColumnTypes(#"Added Index",{{"CalendarYear", Int64.Type}})
in
#"Changed Type"
Replace CalendarTable by your calendar table ( date table ) name
In the RemoVe Columns remove all columns except the Year from your CalendarTable
Follow the rest of the code.
WHat this does is using the calendar ( Date) table it create a table with just the year and index them from 1 to last year in the table.
Call this as YearTable.
Close the Eidt Query.
Expand the columns of YearTable in the DataView
Click on the YearColumn .
Set the Sort ByColumn to Index.
Using Manage Relationship set a relationship between CalendarTable- Year column with the YearTable - YearColumn
Now create a new SunBurst chart.
Put the YearTable-YearColumn as your legend. Values as your measure.
This will work.
If you can share the pbix put in Google or OneDrive and paste the link here for me to put this and send back to you.
Cheers
CheenuSing
- FGH4 years agoRegular Visitor
Hello Anonymous , I found your explanation very helpful. I am currently facing a similar issue as Bakhtawar, but I am not enabled to edit queries, as I am using a fixed dataset and the level of interaction I can have with the data is limited. I think it would be very helpful for Power BI users to be able to sort the legend data alphabetically or numerically using the visual headers in sunburst charts. Are you aware of any ways to "ask" microsoft to add this feature and monitor its development? Thank you both, I hope this was the right section to ask this type of question!