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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Using containers in a Custom Visual

Hi,

I am currently trying to use containers to group properties per measure group. 

Unfortunately, I can see the dropdown on the properties pane but its empty... nothing gets assigned to it.

Anyone using this feature that could provide an example? It would be great to have this sample on the documentation.

 

Thank you


Regards

LS

3 REPLIES 3
dm-p
Super User
Super User

Hi there,

Are you looking to have a dropdown to display the measures in your visual and then display properties based on selection, kind of like the core visuals? If so, last time this asked, it wasn't supported.

However... I do see that Power KPI is open source now, and this may have some of the functionality you're after. I agree that an example of this would be very helpful!

I don't have a lot of time to dive fully into this right now and I've been saving such an activity for a rainy day. I've done a quick analysis and followed some breadcrumbs in the code and this might guide you in the right direction:

I hope that this might be helpful in some capacity, and if you get moving, let us know how you get on! It would be great to see if someone else is able to get this stuff working.

Good luck,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




jppp
Continued Contributor
Continued Contributor

Indeed, my last attempt of dynamic dropdowns failed as I do believe it is still not supported: the result of the enumerateObjectInstances method doesn't parse metadata and dropdowns are defined as static metadata 😞

 

But you can create a loop to populate the same settings for multiple field values. I have create a method(s) to do this like this one: 

public dataShapesEnumerateObjectInstances(dataPoints: ChartDataPoint[]): VisualObjectInstance[] {
    let instances: VisualObjectInstance[] = [];
    dataPoints.forEach((dataPoint: chartDataPoint, index: number) => {
        instances.push({
            displayName: `${dataPoint.label} - line size`,
            objectName: "shapes",
            selector: { id: index.toString(), metadata: undefined },
            properties: {
                strokeWidth: dataPoint.lineSize
            }
        });
        instances.push({
            displayName: `${dataPoint.label} - line type`,
            objectName: "shapes",
            selector: { id: index.toString(), metadata: undefined },
            properties: {
                lineStyle: dataPoint.lineStyle // defined as enum inline with capabilities.json
            }
        });
    });
    return instances;
}

Call it in enumerateObjectInstances 

via instances = this.dataColorsEnumerateObjectInstances(this.data.dataPoints);

 
And define the metadata in capbilities.json:
"shapes": {
    "displayName": "Shapes",
    "properties": {
        "strokeWidth": {
            "displayName": "Stroke size",
            "type": {
                "numeric": true
            }
        },
        "lineStyle": {
            "displayName": "Line style",
            "type" : {
                "enumeration": [
                    {
                        "value": "0",
                        "displayName": "Dashed"
                    },
                    {
                        "value": "1",
                        "displayName": "Solid"
                    },
                    {
                        "value": "2",
                        "displayName": "Dotted"
                    }
                ]
            }
        }
    }
}
This should result in a (long) list of the same properties grouped per field value, in your case the content of the calculation groups.
 
-JP

I've created an idea for this, as there didn't seem to be one already. Not sure if it will get any traction, but if you'd like to vote, go nuts!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.