Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hello,
I have created a new custum visual displaying multiple single values.
So I have this in my capabilities.json :
"dataRoles": [
{
"displayName": "Data",
"name": "category",
"kind": "Grouping"
}
],
...
"objects": {
"boolSettings": {
"displayName": "Bool settings",
"properties": {
"valueIfTrue": {
"displayName": "Value if true",
"type": {
"text": true
}
}
}
}
},
...
into the visual.ts I added
public enumerateObjectInstances(options: powerbi.EnumerateVisualObjectInstancesOptions): powerbi.VisualObjectInstanceEnumeration {
let objectName = options.objectName;
let properties: VisualObjectInstance[] = [];
switch (objectName) {
case "boolSettings":
if (this.viewModel) {
for (let dp of this.viewModel.data) {
debugger
if (typeof dp.value != "boolean")
continue
properties.push({
objectName,
displayName: "Value if true for :" + dp.title,
properties: {
valueIfTrue: dp.boolSetting.ValueIfTrue,
},
selector: dp.identity.getSelector()
})
}
}
break;
}
debugger
return properties;
}
and my data are fill like this :
for (let i = 0; i < view.categories.length; i++) {
let category = view.categories[i];
debugger
data.push({
title: category.source.displayName,
value: <string>category.values[0],
identity: host.createSelectionIdBuilder()
.withCategory(category, 0)
.createSelectionId(),
boolSetting: {
ValueIfFalse: "true"
}
})
}and the settings are link with this :
for (let i = 0; i < data.length; i++) {
let objects = options.dataViews[0].categorical.categories[i].objects;
if (objects == undefined)
continue
let object = objects[0]
data[i].boolSetting.ValueIfTrue = dataViewObjects.getValue(object, {
objectName: "boolSettings",
propertyName: "valueIfTrue"
}, data[i].boolSetting.ValueIfTrue)
}
both methods are called one after the other.
With one category it's working fine, I can change the value. But with multiple categories all values are the same.
I looked in the debbuger and all identities seems to be the same.
here is the sample for two categories ("ifc" and "nwc" from the table "Files")
"key": "{\"and\":{\"l\":{\"comp\":{\"k\":0,\"l\":{\"col\":{\"s\":{\"e\":\"Files\"},\"r\":\"ifc\"}},\"r\":{\"const\":{\"t\":5,\"v\":true}}}},\"r\":{\"comp\":{\"k\":0,\"l\":{\"col\":{\"s\":{\"e\":\"Files\"},\"r\":\"nwc\"}},\"r\":{\"const\":{\"t\":5,\"v\":true}}}}}}"
how could I a different value for each category ?
thank you
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |