Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 ?
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!
@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
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |