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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
VizDataLtd
Helper I
Helper I

Multiple category fields result in merged Sort Axis option

Hello,

I'm building a custom visual (you can see part of it, in pink, at the top). It allows the user to drag and drop multiple Category fields, in the screenshot these are called New Column and Day of Week. But if there is more than one category, I notice the Sort axis dropdown doesn't list my fields separately: it merges them into one item ("NewColumn Day of Week" and the resulting sort seems random.

 

VizDataLtd_0-1717507386609.png

I would like each field listed as a separate sort option. Is this possible?

 

Here are the relevant parts of my capabilities file:

 

{
    "dataRoles": [
      {
        "displayName": "Category (mandatory)",
        "name": "category",
        "kind": "Grouping",
        "description": "Series by which you wish to group data"
      },
      {
        "displayName": "Number series (mandatory)",
        "name": "number",
        "kind": "Measure",
        "description": "Numerical series that will determine width of rectangles within filter bar"
      },
      {
        "displayName": "Sort By (optional)",
        "name": "sortBy",
        "kind": "Measure",
        "description": "If you wish to sort the categories by a custom order (other than by Category or Color by Data), provide a series here and then use the visual ellipsis to select Sort Axis."
      },
      {
        "displayName": "Color by data (optional)",
        "name": "measure",
        "kind": "Measure",
        "description": "If Color by Data is 'on' in formatting pane, you must provide Color by Data series in the data pane to drive fill colour."
      }
    ],
...
    
    "dataViewMappings": [
      {
        "conditions": [
          {
            "number": {
              "max": 1
            },
            "measure": {
              "max": 1
            },
            "sortBy": {
              "max": 1
            }
          }
        ],
          "categorical": {
              "categories": {
                  "for": { "in": "category" },
                  "dataReductionAlgorithm": { "top": { "count": 1000 } }
              },
              "values": {
                "select": [
                  {"bind": {"to": "number"}},
                  {"bind": {"to": "measure"}},
                  {"bind": {"to": "sortBy"}}
                ]
              }
          }

}],
    "privileges": [],
    "supportsKeyboardFocus": true,
    "supportsLandingPage": true,
    "supportsEmptyDataView": true,
    "supportsHighlight": true,
    "sorting": {
      "default": {   }
    },
    "tooltips": {
      "supportedTypes": {
          "default": true,
          "canvas": true
      },
      "supportEnhancedTooltips": true,
      "roles": [
          "tooltips"
      ]
    }
  }
  

 

@dm-pTagging in case you can help

2 REPLIES 2
VizDataLtd
Helper I
Helper I

Hi Liu Yang,

 

Thanks for your reply. I'm not looking to create a custom sort. I'm trying to fix what seems to be a bug. If the user drags two categories into the Category data well, I would expect them to see both of them, by default, in the Sort Axis. Instead they see both categories merged in an unusable way.

 

I notice that the standard treemap visual only lists the first category within Sort Axis. So if the user drags "New Column" and then "Day of week" (as per my original example) into the Treemap visual, sort axis would only offer them "New Column". Is there a way I can achieve this? This would at least not appear to be a bug to the user. Thanks in advance.

Anonymous
Not applicable

Hi  @VizDataLtd ,

 

Do you want to customize the sorting based on multiple columns in a visual?

According to Power BI design, only the table visual supports custom sorting by multiple columns; other visuals do not support this feature at the moment.

You can try placing the fields in the table visual object and use Shift + Left Mouse Click to sort by multiple columns, creating the format you need."

vyangliumsft_0-1717556957307.png

“Then convert the table visual into the visual you need.”

vyangliumsft_1-1717556957308.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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