This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi,
I am trying to create selections using SELECTION MANAGER for a custom visual which uses matrix data mapping but to no avail
Here are the relevant excerpts. Would be so grateful for your time and help
constructor(options: VisualConstructorOptions) {
this.selectionManager = options.host.createSelectionManager();
this.selectionIdBuilder = options.host.createSelectionIdBuilder();
}
public update(options: VisualUpdateOptions) {
let dataViews = options.dataViews[0].matrix;
if (!dataViews
|| !dataViews.rows
|| !dataViews.rows.root
|| !dataViews.rows.root.children
|| !dataViews.rows.root.children.length
|| !dataViews.columns
|| !dataViews.columns.root
|| !dataViews.columns.root.children
|| !dataViews.columns.root.children.length) { return }
let root = d3.hierarchy(dataViews.rows.root)
root.each(d => d.selectionId = this.selectionIdBuilder.withMatrixNode(d, dataViews.rows.levels)
.createSelectionId())
console.log(root)here is dataview mapping from my Capabilities.json
"dataViewMappings": [
{
"matrix": {
"rows": {
"for": {
"in": "Category"
}
},
"values": {
"select": [
{
"for": {
"in": "Measure"
}
}
]
}
}
}
]
Following is snap for my console. I get the selectionID property but it is same for all nodes(parent/child) and the key is null
@dm-p
@Nishantjain @Anonymous
try this https://community.powerbi.com/t5/Developer/multi-selection-with-AND-operator/m-p/781012#M20577
host.createSelectionIdBuilder();
make that code inside each looping
root.each(d => {
let builder = ... ; // create builder here
d.selectionId = builder.withMatrixNode(d, dataViews.rows.levels).createSelectionId();
})
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |