Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi everyone,
I have 2 different problems with the host.persistProperties method with data bound properties. I'm perfectly able to use it with static properties.
1. When the property is bound to a measure I use this syntax:
host.persistProperties({
merge: [
{
objectName: "dataPoint",
properties: {
"color": "#000000"
},
selector: {
metadata: "Sales.Sales Cost"
}
}
]
});In this case the property "color" is stored but I need to call an additional update to see the property in the dataview - in fact the update that comes immediately after the persistProperties call doesn't contain the updated color. Workaround: after calling the host.refreshHostData method the dataview is correctly updated. Is it something that can be fixed? I would avoid using the workaround if possible.
2. When the property is bound to a category, instead, I use this syntax:
host.persistProperties({
merge: [
{
objectName: "dataPoint",
properties: {
"color": "#000000"
},
selector: {
data: [ { "identityIndex": 0 } ]
},
// containerIdx: 0 // I also tried this...
}
]
});Unfortunately, it doesn't seem to work. Please note that the selector in the sample has been created with the selectionIdBuilder.withCategory... Am I missing something or is there an issue?
Thanks,
Daniele
Hi, I'm having the very same issue here. Have you find a solution in the meanwhile? Thanks.
Anyone can help us?
Hi Rico,
I know how the method works, thanks, since I use it in several projects from 6 years 😄
I'm talking about using the method with a not null selector, which is when the issue raises.
Can you provide a working example of using the persistProperties method with a selector pointing to a category bound property? E.g. You have a categorical data mapping and a property that must be saved on categories values like a color for each category.
Thanks
Hi @danieleperilli ,
From the offical blog: VisualConstructorOptions
persistProperties, allows users to create persistent settings and save them along with the visual definition, so they're available on the next reloadYou can look for an example in powerbi-visuals-sankey custom visual, where it is used to store various properties.
A rough example for your case:
options.host.persistProperties({
VisualObjectInstance = {
objectName: "filterSetting",
selector: undefined,
properties: {
filter: "xyz"
}
};
});
After triggering the persistProperties function, the visual triggers an update, populating the VisualUpdateOptions' options.dataViews.metadata.objects with the persisted property. Note, that you have to define your property in the capabilities.json beforehand.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.