Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Bakhtawar
Post Patron
Post Patron

Sorting order in legend

I tried subburst chart 

and drag year field and enable legend also from properties but this shows that legend is not in order whereas year field is already sorted in data .. i checked it through dragging field in dropdown 

 

now how i sort that legend 

 

check image 

Untitled.png

4 REPLIES 4
Anonymous
Not applicable

Hi @Bakhtawar ,

 

The legend goes by the  value being plotted than by year. This is true for pie chart also.

 

Cheers

 

CheenuSing

how to resolve this
Anonymous
Not applicable

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

 

 

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!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors