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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
ShrimpSurf
Helper II
Helper II

How to Reverse Sort of Column Headers

How do you reverse the sort of column headers?   In my example the sort is from 2018 to 2022.  I would to go from most recent year to oldest.   Help please!

 

Screen Shot 2021-12-31 at 11.21.14 AM.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ShrimpSurf 

You can create a conditional column to add a reverse index .

(1)Add a conditional column in Power Query .Set year 2022=1,2021=2…

Ailsamsft_0-1641275389040.png

Ailsamsft_1-1641275389042.png

(2)Go back to Desktop view, and choose the column [year] ,sort by the conditional column .

Ailsamsft_2-1641275389044.png

The final result is as shown :

Ailsamsft_3-1641275389044.png

I have attached my pbix file , you can refer to it .

 

Best Regard

Community Support Team _ Ailsa Tao

View solution in original post

7 REPLIES 7
ced1971
Frequent Visitor

To avoid creating a static table to sort years I would create a new column being 2100 - [Year] and simply sort on that new integer value

Anonymous
Not applicable

Hi @ShrimpSurf 

You can create a conditional column to add a reverse index .

(1)Add a conditional column in Power Query .Set year 2022=1,2021=2…

Ailsamsft_0-1641275389040.png

Ailsamsft_1-1641275389042.png

(2)Go back to Desktop view, and choose the column [year] ,sort by the conditional column .

Ailsamsft_2-1641275389044.png

The final result is as shown :

Ailsamsft_3-1641275389044.png

I have attached my pbix file , you can refer to it .

 

Best Regard

Community Support Team _ Ailsa Tao

aj1973
Community Champion
Community Champion

Hi @ShrimpSurf 

In the table where field date/year is, add a column where you rank the years descending, like 2022 equals 1, 2021 equals 2 , 2020 equals 3.... Once the column is added go back to the field in the report and sort it by 

aj1973_0-1640974051799.png

the name of the new added column.

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

ebeery
Memorable Member
Memorable Member

@ShrimpSurf @bcdobbs I don't believe Power BI will let you sort the column headers in descending order if there are also row fields added to the matrix.  I think a technique like the one described below is required for this:

https://www.biinsight.com/quick-tips-how-to-sort-matrix-by-column-in-descending-order/ 

bcdobbs
Community Champion
Community Champion

Thanks @ebeery, that'll teach me to reply from memory! Had to boot laptop up to check but yes 100% correct you do have to trick it with a sort order column.

 

Have a great new year.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Haha @bcdobbs  definitely seems like one of those things that should be possible, but still has to be "hacked" ☹️.

 

Thanks, you too!

bcdobbs
Community Champion
Community Champion

If you click on the visual 3 dots should appear (normally top right). It should give you options on sorting.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
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