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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Performance Issues with multi row selection

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

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

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

pbicvsupport@microsoft.com

View solution in original post

7 REPLIES 7
v-viig
Community Champion
Community Champion

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

pbicvsupport@microsoft.com

 

 

Anonymous
Not applicable

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!

v-viig
Community Champion
Community Champion

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

pbicvsupport@microsoft.com

 

Anonymous
Not applicable

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

v-viig
Community Champion
Community Champion

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

pbicvsupport@microsoft.com

Anonymous
Not applicable

Well that kinda sucks 😞 But thanks again for the fast answer!

I will implement an internal logic to filter the data.

 

regards lschroth

Anonymous
Not applicable

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

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors