March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hey!
I have a custom visual with a process graph, in this graph I can select edges and filter the graph to only show processes with this specific edge.
I'm using a Table DataViewMapping and I am creating my selection IDs with this Code:
function getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] { return dataView.table.identity.map((identity: DataViewScopeIdentity) => { const categoryColumn: DataViewCategoryColumn = { source: dataView.table.columns[1], values: null, identity: [identity] }; return host.createSelectionIdBuilder() .withCategory(categoryColumn, 0) .createSelectionId(); }); }
If I have a selection in my graph I am getting all selected rows selectionIds and pass them to the selection manager as an array.
// Select all cases with the specific edge in their path for (i = 0; i < viewModel.eventlogData.length; i++) { if (viewModel.eventlogData[i].path.search(id_from + "::" + id_to) >= 0) { selectionIdArray.push(viewModel.eventlogData[i].selectionID); } } selectionManager.select(selectionIdArray, true); selectionManager.applySelectionFilter();
The creation of this selectionIdArray is not the problem, it only takes a few ms, but I looks PowerBI will get slower (up to 2 min for 1500 rows/elements in the array) the more selectionIds I pass.
Is there a better/faster way to multiselect multiple rows?
All help is kindly appreciated!
Regards
lschroth
Solved! Go to Solution.
No, it is not possible as own filter will not be applied to itself.
We'd recommend to implement an internal logic to filter data inside your visual.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Power BI doesn't handle such big selection fast as 1500 SelectionIds will be converted to internal filter object.
Unfortunately, this operation is pretty expensive.
Is it possbile to specify a range of values for a filter?
If so, we'd recommend to use JSON Filter instead.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hey @v-viig,
I tried to use the JSON Filter but I don't know how to call the applyJsonFilter Method from the IVisualHost interface. In the Documentaion the call is with three parameters but the function needs four. Can you please explain to me how to call the function in the right way?
let conditions = { operator: "Contains", value: id_from + "::" + id_to } let target:IFilterColumnTarget = { table: tempMetadata.queryName.substr(0, tempMetadata.queryName.indexOf('.')), column: tempMetadata.displayName } let filter:IAdvancedFilter = new window['powerbi-models'].AdvancedFilter(target, "And", conditions); host.applyJsonFilter(filter, "general", "filter", ???);
Regards lschroth!
The fourth argument is FilterAction. We'd recommend to use FilterAction.merge as a fourth argument.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
I achieved that the data is filtered for every visual on the page besides for the visual itself from where I call the applyJsonFilter method, but I need the filtered data in this visual aswell. Is it possible to filter the data for the visual itself from where I create the filter?
Regards
lschroth
No, it is not possible as own filter will not be applied to itself.
We'd recommend to implement an internal logic to filter data inside your visual.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Well that kinda sucks 😞 But thanks again for the fast answer!
I will implement an internal logic to filter the data.
regards lschroth
Thanks! I will try the JSON Filter with the "Contains" criteria because we filter on a string containing a substring. Hopefully I can post a solution soon
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
8 | |
3 | |
2 | |
1 | |
1 |
User | Count |
---|---|
6 | |
3 | |
2 | |
2 | |
2 |