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

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

Reply
Triplee74
Frequent Visitor

Custom visual: Issue with dataReductionAlgorithm in capabilities.json

Hi,

 

I am having issues with my dataReductionAlgorithm. I have attached my capabilities.json code below.

 

I am working on a custom visual with 3 fields, one category and two measures. My issue is that the dataReductionAlgorithm only fires if I add ALL three field into the visual, then it limits the data table to 1 row. Until I add all 3 fields, the data table includes ALL data.

 

Any ideas?

 

 

"dataRoles": [
        {
            "displayName": "KPI Name",
            "name": "category",
            "kind": "Grouping"
        },
        {
            "displayName": "KPI Value",
            "name": "kpimeasure",
            "kind": "Measure"
        },
        {
            "displayName": "Target Value",
            "name": "targetmeasure",
            "kind": "Measure"
        }
    ],

"dataViewMappings": [ {
            "conditions": [
                {
                    "category": { "max": 1},
                    "kpimeasure": { "max": 1},
                    "targetmeasure": { "max": 1}
                }
            ],
            "categorical": {
                "categories": { 
                    "for": { "in": "category" },
                    "dataReductionAlgorithm": { "top": {"count": 1} } 
                },
                "values": {
                    "select": [
                        { "bind": { "to": "kpimeasure" } },
                        { "bind": { "to": "targetmeasure" } }
                    ],
                    "dataReductionAlgorithm": { "top": {"count": 1} } 
                }
            }
        }
    ]

 

 

 

1 ACCEPTED SOLUTION
Triplee74
Frequent Visitor

After some testing I suddenly got it to work, to be honest I don't know why. 

    "dataViewMappings": [ {
            "conditions": [
                {
                    "category": { "max": 1},
                    "kpimeasure": { "max": 1},
                    "targetmeasure": { "max": 1}
                }
            ],
            "categorical": {
                "categories": { 
                    "for": { "in": "category" },
                    "dataReductionAlgorithm": { "top": {"count": 1} } 
                },
                "values": {
                    "select": [
                        { "bind": { "to": "kpimeasure" } },
                        { "bind": { "to": "targetmeasure" } }
                    ],
                    "dataReductionAlgorithm": { "top": {"count": 1} }
                }
            }
        }
    ]

View solution in original post

1 REPLY 1
Triplee74
Frequent Visitor

After some testing I suddenly got it to work, to be honest I don't know why. 

    "dataViewMappings": [ {
            "conditions": [
                {
                    "category": { "max": 1},
                    "kpimeasure": { "max": 1},
                    "targetmeasure": { "max": 1}
                }
            ],
            "categorical": {
                "categories": { 
                    "for": { "in": "category" },
                    "dataReductionAlgorithm": { "top": {"count": 1} } 
                },
                "values": {
                    "select": [
                        { "bind": { "to": "kpimeasure" } },
                        { "bind": { "to": "targetmeasure" } }
                    ],
                    "dataReductionAlgorithm": { "top": {"count": 1} }
                }
            }
        }
    ]

Helpful resources

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

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.