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

Getting columns in table ordered (or grouped) by dataRoles specified in capabilities.json

Hi,

 

In a custom visual I am developing (using a table data view mapping) I am trying derive which data fields are put into which data roles in the interface. Does anyone have suggestions as to do that?

 

I can iterate through the list of columns, read the keys in their "roles" object, and construct the hierarchy myself that way (using the keys from the list of data roles I have defined in capabilities.json). However, I wonder if Power BI doesn't a more explicit way of doing this, as the data fields mapping to data roles is explicitly defined in the interface. Does anyone know?

 

As mentioned, the custom visualization uses a table data view mapping. To construct the I have declared a series of data roles, which works as semantic groupings, which is understandable. I then select all these data roles in table.rows.select using a list of { "for": { "in": "..." } } matching the data roles. I don't fully understand the effect of the "group" key used for the categorical view mapping: https://github.com/Microsoft/PowerBI-visuals/blob/master/Capabilities/DataViewMappings.md (or whether that is applicable for the table data view mapping), but perhaps that could be a way to go?

 

Any way, any help is greatly appreciated Smiley Happy

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-viig
Moderator

Re: Getting columns in table ordered (or grouped) by dataRoles specified in capabilities.json

There's no better way to parse table mapping. As you mentioned values can be parsed using dataView.table.columns and roles field.

Such implementaiton will allow to match column index and value index.

 

The group field allows to group values by particular column.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

2 REPLIES 2
Moderator v-viig
Moderator

Re: Getting columns in table ordered (or grouped) by dataRoles specified in capabilities.json

There's no better way to parse table mapping. As you mentioned values can be parsed using dataView.table.columns and roles field.

Such implementaiton will allow to match column index and value index.

 

The group field allows to group values by particular column.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

matthiasnielsen Frequent Visitor
Frequent Visitor

Re: Getting columns in table ordered (or grouped) by dataRoles specified in capabilities.json

@v-viig

 

Thanks for your response - nice to know further investigation would be futile.

 

I'll mark your response as solution.

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 48 members 1,181 guests
Please welcome our newest community members: