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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
clongwell
New Member

How to set the sort order on a clustered bar chart

Dear hive mind, I am a bit baffled by how to propperly sort my clustered bar chart so the axis is descending according to a specified series.  This chart shows a 5 year history various things, and the yellow series is the latest year. I have selected "Sort Descending", but it appears that it is doing that based on the series average rather than specifying which series (the one in yellow).  Is there a way to drive that?

 

Much thanks!

clongwell_0-1744611745149.png

1 ACCEPTED SOLUTION

Hi @clongwell,
Thank you for posting your query in the Microsoft Fabric Community.

I’ve reproduced your scenario using my sample data and confirmed that the clustered column chart can be sorted by a specific series in this case, the 2024 bars (pink in my visuals, corresponding to your yellow "January" series). Here’s how I achieved it:

  • Unpivoted the data to create a single SalesTable with columns: Category, Year, Sales.
  • Created a helper table (CategorySortTable) to calculate the 2024 totals for each category using DAX:
CategorySortTable =

SUMMARIZE(

  FILTER('SalesTable', 'SalesTable'[Year] = "2024"),

  'SalesTable'[Category],

  "SortValue", SUM('SalesTable'[Sales])

)
  1. Sorted CategorySortTable[Category] by its SortValue column in descending order.
  2. Established a one-to-many relationship: CategorySortTable[Category] (one) → SalesTable[Category] (many).
  3. Built the clustered column chart with:
    • X-Axis: CategorySortTable[Category]
    • Legend: SalesTable[Year]
    • Y-Axis: SalesTable[Sales]
    • Sort Order: Descending by the axis field (which uses the 2024 values from SortValue).

The result matches your requirement: the clusters are sorted by the 2024 values in descending order, with the highest 2024 value on the right.

For your reference, here’s the output in the visual:

  • Categories A→E along the X-axis, ordered by their 2024 sales (approximately 210, 180, 160, 130, 90).
  • Within each category, bars for 2020–2024, with the 2024 bar in pink (equivalent to your yellow "January" series).

I’ve attached a .pbix file with all these steps and the final chart. Feel free to download it and explore the model.

If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

View solution in original post

7 REPLIES 7
v-ssriganesh
Community Support
Community Support

Hi @clongwell,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

v-ssriganesh
Community Support
Community Support

Hi @clongwell,

Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @danextian for sharing valuable insights.

 

Could you please confirm if your query has been resolved by the provided solution? If so, please mark it as the solution. This will help other community members solve similar problems faster.

Thank you.

No... I am not trying to sort the legend, but rather sort the clusters on the axis by the series in yellow (on the right).  When I sort the axis descending it seems to use an average?  

Hi @clongwell,
Thank you for posting your query in the Microsoft Fabric Community.

I’ve reproduced your scenario using my sample data and confirmed that the clustered column chart can be sorted by a specific series in this case, the 2024 bars (pink in my visuals, corresponding to your yellow "January" series). Here’s how I achieved it:

  • Unpivoted the data to create a single SalesTable with columns: Category, Year, Sales.
  • Created a helper table (CategorySortTable) to calculate the 2024 totals for each category using DAX:
CategorySortTable =

SUMMARIZE(

  FILTER('SalesTable', 'SalesTable'[Year] = "2024"),

  'SalesTable'[Category],

  "SortValue", SUM('SalesTable'[Sales])

)
  1. Sorted CategorySortTable[Category] by its SortValue column in descending order.
  2. Established a one-to-many relationship: CategorySortTable[Category] (one) → SalesTable[Category] (many).
  3. Built the clustered column chart with:
    • X-Axis: CategorySortTable[Category]
    • Legend: SalesTable[Year]
    • Y-Axis: SalesTable[Sales]
    • Sort Order: Descending by the axis field (which uses the 2024 values from SortValue).

The result matches your requirement: the clusters are sorted by the 2024 values in descending order, with the highest 2024 value on the right.

For your reference, here’s the output in the visual:

  • Categories A→E along the X-axis, ordered by their 2024 sales (approximately 210, 180, 160, 130, 90).
  • Within each category, bars for 2020–2024, with the 2024 bar in pink (equivalent to your yellow "January" series).

I’ve attached a .pbix file with all these steps and the final chart. Feel free to download it and explore the model.

If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

I'm following you, but wow that is complex for a newbie!  Appreciate the sample file.

danextian
Super User
Super User

Hi @clongwell 

 

You should be able to sort by legend alphabeticaly or by a custom column sort column.

danextian_0-1744615965085.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

In this example, I want to sorth the groups descending by the "January" value

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.