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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mw
Regular Visitor

Custom Sort by x-axis legend

How can I add a custom Sort in a line chart with the legend

 

1W1M2M3M6M1Y2Y

 

and so on...

 

 

I tried to add a sort column and used "Modeling", "Sort by Column" but it doesn't work.  Does anyone have an idea how to solve the problem? Many thanks.

 

Table.PNGModelling.PNG

1 ACCEPTED SOLUTION
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

Hi @mw,

In your scenario, please create a new table to sort CHF Swap Rates with desired order as follows, then merge this new query to you original query and retain the order column.
1.PNG


After that, please click the CHF Swap Rates column in the Field Pane, then select the order column after clicking “Sort By Column” under Modeling ribbon. This way, you are able to achieve your requirement. For more details, you can review the example in the attached PBIX file.
2.PNG


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

Hi @mw,

Could you please describe more details about your scenario? We need to know which field you put in legend and the exact error message you get when using “Sort by Column” option. In addition, if you want to sort the column ‘Perzentil’ by ‘SortBy’, you need to make sure that the values in the Perzentil column map m:1 with the SortBy column.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you Lydia

 

The Chart looks now like that:

 

 

chart.PNG

 

I'd like to have several curvers for the percentiles for the several CHF Swap Rates (x-axis). That is fine so far. But the Legend of the x-axis should ordered by the duration (1W = 1Week, 1M = 1 Month, 2M = 2 Month....1Y = 1 Year...up to 30 Y). 

 

For this purpose I tried to add a column "SortBy" and used "Modeling", "Sort by Column". I didn't get an error Message but it didn't work as you can see on the picture of the chart. 

 

Thanks Martin

 

v-yuezhe-msft
Microsoft Employee
Microsoft Employee

Hi @mw,

In your scenario, please create a new table to sort CHF Swap Rates with desired order as follows, then merge this new query to you original query and retain the order column.
1.PNG


After that, please click the CHF Swap Rates column in the Field Pane, then select the order column after clicking “Sort By Column” under Modeling ribbon. This way, you are able to achieve your requirement. For more details, you can review the example in the attached PBIX file.
2.PNG


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I tried using this approach for a similar problem I'm facing. I have a table with two columns:

 

Column 1 = Modules

Column 2 - Hrs spent

 

Just that module list comprises of 1, 2, 3, 4, 5a, 5b, 5c, 6, General, Another project, etc. Basically, they're not all numeric, so I couldn't sort them as is. I created a secondary table called "Sorter table" that has two columns:

 

Column 1 = Module

Column 2 = Sort ID

 

and used this new table to sort the module alphanumeric entries as I wanted them.

 

Then I went to the relationship view and linked the "Modules" field (from Table 1) to the "Module" field (from Table 2).

 

I still don't get how to use this new Sort ID column to sort my modules on the X-axis.

 

Any help appreciated.

I have a problem with sort by column option. I get a warning that  The column can't be sorted by a column that is already sorted directly or indirectly, by this column. This is because I have a sort my outcome into 6 buckets (0-7 days, 8-30 day, ....) So to give this a rank I uses the IF formula. But then the sort by column doesn't work is there an alternative do reach the same?

Thanks a lot, 

Martin

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.