cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

how to determine column order for table dataViewmapping with multiple measures

Hi I'm creating a custom visual and have used the standard table dataViewMapping

 

"dataViewMappings": [
        {
            "table": {
                "rows": {
                    "select": [
                        {
                            "for": {
                                "in": "category"
                            }
                        },
                        {
                            "for": {
                                "in": "measure"
                            }
                        }
                    ]
                }
            }
        }
    ],

 

It parses the results just fine.

 

"table":{
  "columns": [
    {
      "roles": {...},
      "type": {...},
      "format": undefined,
      "displayName": "Category",
      "queryName": "Product.Category",
      "expr": {...},
      "rolesIndex": {...},
      "index": 0,
      "identityExprs": [..]
    },
    {
      "roles": {...},
      "type": {...},
      "format": "#,0.00",
      "displayName": "Measure1",
      "queryName": "Avg(Sales.Unit Price)",
      "expr": {...},
      "rolesIndex": {...},
      "index": 1,
      "isMeasure": true,
      "aggregates": [..]
    },
    {
      "roles": {...},
      "type": {...},
      "format": "#,0.00",
      "displayName": "Measure2",
      "queryName": "Sum(Sales.Sales)",
      "expr": {...},
      "sort": 1,
      "sortOrder": 0,
      "rolesIndex": {...},
      "index": 2,
      "isMeasure": true,
      "aggregates": [...]
    }
  ],
  "identity": [...],
  "identityFields": [...],
  "rows": [...]
}

 

However I want to know the order in which  the Measures are listed by the user in "Measure Data". If you look at a normal table, the columns get switched when you swap the order in the Data Fields Pane.
I don't see that change happening in the DataView.
How can I check what the order is of the measures?

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.