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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Sort Order in Chart

Hi, I am trying to change the order of this bar chart from 2015, 2016, 2017... to 2019, 2018, 2017... The year is modeled as a whole number and picture is attached below. I have been able to change the order in a chart but not in the visual. Thanks!

 

image.png

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

since you are using this as a legend on your chart you are not abble to change the way it's order in the visual.

 

You have two work around :

 

Create a calculated column with the following syntax:

ranking = RANKX (
    'Table1';
    CALCULATE (
        MAX(Table1[Year] );
        ALLEXCEPT (Table1;Table1[Year] )
    );
    ;
    DESC;
    DENSE
)

Then sort the Colunm Year by this column (this will make all you other visuals change accordingly to this new sorting.

 

One work around is to create a table with two columns (Year and ID)

 

Year      ID

2019      1

2018      2

2017      3

2016      4

2015      5

 

Then sort the year column by the ID column, make a relationship between this table and the other table where you have the Year. Finally replace the year on the legend by the year of the last table you created.

 

 

Regards,

MFelix

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Anonymous ,

 

since you are using this as a legend on your chart you are not abble to change the way it's order in the visual.

 

You have two work around :

 

Create a calculated column with the following syntax:

ranking = RANKX (
    'Table1';
    CALCULATE (
        MAX(Table1[Year] );
        ALLEXCEPT (Table1;Table1[Year] )
    );
    ;
    DESC;
    DENSE
)

Then sort the Colunm Year by this column (this will make all you other visuals change accordingly to this new sorting.

 

One work around is to create a table with two columns (Year and ID)

 

Year      ID

2019      1

2018      2

2017      3

2016      4

2015      5

 

Then sort the year column by the ID column, make a relationship between this table and the other table where you have the Year. Finally replace the year on the legend by the year of the last table you created.

 

 

Regards,

MFelix

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.