Forum Discussion

atrkgl's avatar
atrkgl
New Member
3 years ago

PowerBI Custom Visual - Two Grouping Measures

Hello PowerBI Team,

 

I want to create a custom visual that accepts multiple grouping fields with measures. It works successfully, when I use a single grouping field. However, when I add another grouping field, in the debugging console, I saw that there is an entry in metadata, however the array of values are not shown for the second grouping field. Could you help me, how can I reach values of each field in capabilities.json? 

 

In this specific case, I need a set of array values for the target value (I want to disable aggregation/sum operations) that is a GroupingOrMeasure type, xaxis field as a Grouping type, yaxis and forecastingValue as a Measure type. At the end, I want to see all these values in the array for the custom visual.

 

 "dataRoles": [
        {
            "displayName": "X Axis",
            "name": "xaxis",
            "kind": "Grouping",
            "requiredTypes": [
                {
                    "text": true
                }
            ],
            "preferredTypes": [
                {
                    "text": true
                }
            ]
        },
        {
            "displayName": "Y Axis",
            "name": "yaxis",
            "kind": "Measure",
            "requiredTypes": [
                {
                    "numeric": true
                },
                {
                    "integer": true
                }
            ],
            "preferredTypes": [
                {
                    "numeric": true
                },
                {
                    "integer": true
                }
            ]
        },
        {
            "displayName": "Target Value",
            "name": "targetValue",
            "kind": "GroupingOrMeasure",
            "requiredTypes": [
                {
                    "numeric": true
                },
                {
                    "integer": true
                }
            ],
            "preferredTypes": [
                {
                    "numeric": true
                },
                {
                    "integer": true
                }
            ]
        },
        {
            "displayName": "Forecasting Value",
            "name": "forecastingValue",
            "kind": "Measure",
            "requiredTypes": [
                {
                    "numeric": true
                },
                {
                    "integer": true
                }
            ],
            "preferredTypes": [
                {
                    "numeric": true
                },
                {
                    "integer": true
                }
            ]
        }]
 
 "dataViewMappings": [
        {
            "conditions": [
                { "xaxis": { "max": 1 }, "yaxis": { "max": 1 },  "targetValue": { "max": 1 }, "forecastingValue": { "max": 1 }}
            ],
            "categorical": {
                "categories": {
                    "for": { "in": "xaxis" }
                },
                "values": {
                    "select": [
                        { "bind": { "to": "yaxis" } },
                        { "for": { "in": "targetValue" } },
                        { "bind": { "to": "forecastingValue" } }
                    ]
                }
            }
        }
    ]
 
I would be happy, if you can help me on this issue. Thank you very much!
 
Best regards
No RepliesBe the first to reply