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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ztyler
Regular Visitor

Binding a Capabilities Object to all data points of a given Category value using a Selection ID

Hello,

 

I'm attempting to create a dynamic property that populates object properties based on the available values in a category.

 

My dataView is defined like so:

{
	"categorical": {
		"categories": {
			"select": [
				{ "for": { "in": "group1" } },
				{ "for": { "in": "group2" } },
				{ "for": { "in": "group3" } }
			]
		},
		"values": {
			"select": [
				{ "for": { "in": "measure1" } },
				{ "for": { "in": "measure2" } },
				{ "for": { "in": "measure3" } },
				{ "for": { "in": "measure4" } }
			]
		}
	}
}

My goal is simple: if there's 3 unique values in group1 (e.g. 1, 2, or 3), then I'd like 3 unique properties under an object in the properties pane, like the example given here, or commonly seen under the "Data Colors" object on a pre-built visual.

 

However, the linked example creates a unique property for every datapoint, which is not what I want to do at all. If there are 100 values under category 1, 100 under category 2, and 100 under category 3, I only want to see 3 properties, not 300.

 

Looping over the unique values during Object Enumeration is easy enough, however I'm confused by the creation of SelectionIds. How can SelectionIds be created so that the VisualObjectInstance.selector is referencing a collection of values?

 

P.S. reading here, it seems like withSeries may help do what I need, but the desciption of it is extremely vague.

 

For more context, all the dynamic Object Enumeration examples I see are like this:

case 'objectNameStr':
            for(let dataPoint of this.dataPoints) {
                objectEnumeration.push({
                    objectName: objectName,
                    displayName: dataPoint.category,
                    properties: {
                        fill: {
                            solid: {
                                color: dataPoint.color
                            }
                        }
                    },
                    selector: dataPoint.selectionId.getSelector()
                });
            }
            break;

 

But I'm trying to do something more like this:

case 'objectNameStr':
            for(let group of uniqueGroups) {
                objectEnumeration.push({
                    objectName: objectName,
                    displayName: group.value,
                    properties: {
                        fill: {
                            solid: {
                                color: group.color
                            }
                        }
                    },
                    selector: [What goes here?]
                });
            }
            break;

Thanks in advance.

0 REPLIES 0

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors