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
cplih
Regular Visitor

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
cplih
Regular Visitor

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 ....

@cplih, 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

@cplih 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
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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.