Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
Here's my capabilities.json:
{ "dataRoles": [ { "displayName": "Name", "name": "name", "kind": "Grouping" }, { "displayName": "Description", "name": "description", "kind": "Grouping" }, { "displayName": "Sector", "name": "sector", "kind": "Grouping" }, { "displayName": "Ring", "name": "ring", "kind": "Grouping" }, { "displayName": "Is new?", "name": "isNew", "kind": "Grouping" } ], "dataViewMappings": [ { "table": { "rows": { "select": [ { "for": { "in": "name" } }, { "for": { "in": "description" } }, { "for": { "in": "sector" } }, { "for": { "in": "ring" } }, { "for": { "in": "isNew" } } ] } } } ] }
However, in my visual, when I run console.log(dataViews[0].table.rows), I see that for each row, it provides the description first, then isNew, name and ring, and finally sector. I presume it is sorting these alphabetically rather than a random sort and it appearing this way by coincidence - but either way, the fact remains that this order is pretty much useless to me as a developer.
In fact, it's not even sorted by the column names that I define - it's sorted by the column names that the user defines.
I would expect that because I defined name first in capabilities.json, it would appear as the first column of each row, so for example to get the name of the first row I would use dataViews[0].table.rows[0][0]. But with this method of ordering I don't actually know what index the name will be at.
How do I get around this issue?
Thanks.
Solved! Go to Solution.
Check "options.dataViews[0].table.columns[0].roles".
Check "options.dataViews[0].table.columns[0].roles".
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
7 | |
2 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |