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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Help with capabilities.json

Hey All, thank you for your help in advance!   


I need to have my capabilities.json with the ability to have : One - Categoty data (for Id's) and One More seperated one that will be used to codeToText the id with some meaningfull data to the user for example some link or text... 
In Data Source it looks like below : 
123123123, Storm, ..... many more rows

9879789789, Rain, ..... many more rows

456456456, Snow, ..... many more rows

Elaboration - 

id's list : (awalable to me in the code)
123123123, 9879789789, 456456456
codeToText list (this what the user will see in the visual table instead of id's):
Storm, Rain,  Snow

I can define 2 deferent named  sections of dataRoles  but i cannot manage to define the dataViewMappings for both the dataRoles to have dataReductionAlgorithm applied in paralel ... could someone please help ?

3 REPLIES 3
Anonymous
Not applicable

Hi @DallasBaba  , thank you for your response , i tried to you above example but unfortunately it does not pass compilation ... i will look into the links you gave me but im afraid that i will need some kind of a course of how to use the capabilities ....

@Anonymous, I'm sorry my example didn’t work for you.  You can read more at Microsoft Learn.

 

Or try to define a Data Roles within capabilities.json, create two distinct dataRoles sections:

 

"dataRoles": [
    {
        "displayName": "Category Data",
        "name": "categoryData",
        "kind": "Grouping"
    },
    {
        "displayName": "Code To Text Mapping",
        "name": "codeToText",
        "kind": "Measure"
    }
]

 

Then configure Data View Mappings the fields from your data source to the corresponding data roles:

 

"dataViewMappings": [
    {
        "categorical": {
            "categories": {
                "for": {
                    "in": "categoryData"
                }
            }
        }
    },
    {
        "measure": {
            "measures": {
                "select": [
                    {
                        "bind": {
                            "to": "codeToText"
                        }
                    }
                ]
            }
        }
    }
]

 

Apply Data Reduction Algorithm Within the dataViewMappings sections, specify the dataReductionAlgorithm for each data role

 

"dataViewMappings": [
    {
        /* ... category mapping ... */
        "dataReductionAlgorithm": {
            "top": {
                "count": 100
            }
        }
    },
    {
        /* ... codeToText mapping ... */
        "dataReductionAlgorithm": {
            "top": {
                "count": 50
            }
        }
    }
]

 

Ensure your visual's code handles the separate data roles correctly and applies the display and codeToText functionality mappings. Verify that the data types in your data source match the expected types for the data roles.

 

if my answers contribute to a solution, show your appreciation by giving it a thumbs up

 

Thanks
Dallas
DallasBaba
Skilled Sharer
Skilled Sharer

@Anonymous you can define two different named sections of dataRoles in your capabilities.json file :

"dataRoles": {
    "categoryData": {
        "displayName": "Category Data",
        "kind": "Grouping",
        "description": "Data used for grouping visuals",
        "requiredTypes": [
            "Text",
            "Numeric",
            "DateTime"
        ]
    },
    "codeToText": {
        "displayName": "Code to Text",
        "kind": "Grouping",
        "description": "Data used for mapping codes to text",
        "requiredTypes": [
            "Text",
            "WebUrl"
        ]
    }
}

 

You can refer to the following resources to learn more about DataViewMappings and data reduction algorithms

https://github.com/PowerBi-Projects/PowerBI-visuals/blob/master/Capabilities/DataViewMappings.md

https://learn.microsoft.com/en-us/power-bi/developer/visuals/dataview-mappings

 

Let me know if this works for you. @ me in replies, or I'll lose your thread!!!  
Note:
If this post is helpful, please mark it as the solution to help others find it easily. Also, if my answers contribute to a solution, show your appreciation by giving it a thumbs up

 

 

Thanks
Dallas

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.